Skip to content

Commit 077cbe1

Browse files
author
Publisher
committed
Publish Hugo-generated contents.
1 parent 653dd80 commit 077cbe1

File tree

4 files changed

+166
-2
lines changed

4 files changed

+166
-2
lines changed

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ <h2 id="posts">Posts</h2>
4848

4949
<ul>
5050

51+
<li>
52+
<a href="/posts/modern-git/">Modern Git for Modern Times</a><span>, October 17, 2025</span>
53+
</li>
54+
5155
<li>
5256
<a href="/posts/python-foreign-functions-and-steam/">Python, foreign functions and Steam</a><span>, August 1, 2023</span>
5357
</li>

index.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@
66
<description>Recent content on Artur Dryomov</description>
77
<generator>Hugo</generator>
88
<language>en-us</language>
9-
<lastBuildDate>Tue, 01 Aug 2023 00:00:00 +0000</lastBuildDate>
9+
<lastBuildDate>Fri, 17 Oct 2025 00:00:00 +0000</lastBuildDate>
1010
<atom:link href="https://arturdryomov.dev/index.xml" rel="self" type="application/rss+xml" />
11+
<item>
12+
<title>Modern Git for Modern Times</title>
13+
<link>https://arturdryomov.dev/posts/modern-git/</link>
14+
<pubDate>Fri, 17 Oct 2025 00:00:00 +0000</pubDate>
15+
<guid>https://arturdryomov.dev/posts/modern-git/</guid>
16+
<description>&lt;p&gt;Git has been around for a long time — since April 2005. That’s 20 years!&#xA;Fun fact — &lt;a href=&#34;https://en.wikipedia.org/wiki/GNU_Bazaar&#34;&gt;Bazaar&lt;/a&gt; and&#xA;&lt;a href=&#34;https://en.wikipedia.org/wiki/Mercurial&#34;&gt;Mercurial&lt;/a&gt; were released around the same time as Git.&#xA;Not so fun facts — during this time&#xA;&lt;a href=&#34;https://www.atlassian.com/blog/bitbucket/sunsetting-mercurial-support-in-bitbucket&#34;&gt;Atlassian removed the Mercurial support from Bitbucket&lt;/a&gt;&#xA;and &lt;a href=&#34;https://discourse.ubuntu.com/t/phasing-out-bazaar-code-hosting/62189&#34;&gt;Canonical retired Bazaar altogether&lt;/a&gt;.&#xA;Meanwhile, GitHub and GitLab are alive and well — safe to say, Git is here to stay.&#xA;In fact, we might see &lt;a href=&#34;https://git-scm.com/docs/BreakingChanges#_git_3_0&#34;&gt;Git 3.0&lt;/a&gt; soon — a new version for the new decade.&lt;/p&gt;</description>
17+
</item>
1118
<item>
1219
<title>Python, foreign functions and Steam</title>
1320
<link>https://arturdryomov.dev/posts/python-foreign-functions-and-steam/</link>

posts/modern-git/index.html

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<!DOCTYPE html>
2+
<html lang="en-us">
3+
<head>
4+
<meta charset="utf-8"/>
5+
6+
<title>Modern Git for Modern Times</title>
7+
<meta name="description" content="Modern problems require modern solutions"/>
8+
<meta name="author" content="Artur Dryomov"/>
9+
10+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
11+
12+
<link rel="stylesheet" href="/css/style.css"/>
13+
<link rel="stylesheet" href="/css/syntax-highlighting.css"/>
14+
15+
16+
<meta name="theme-color" content="#1e2327">
17+
18+
</head>
19+
20+
<body>
21+
22+
<header>
23+
<nav>
24+
<ul>
25+
26+
<li class="menu-left"><a href="/">Posts</a></li>
27+
28+
29+
<li class="menu-right"><a href="feed://arturdryomov.dev/index.xml">RSS</a></li>
30+
31+
<li class="menu-right"><a href="https://github.com/arturdryomov">GitHub</a></li>
32+
33+
</ul>
34+
</nav>
35+
36+
</header>
37+
38+
<br/>
39+
40+
41+
<div class="meta">
42+
43+
<h1><span class="title">Modern Git for Modern Times</span></h1>
44+
<h3>October 17, 2025</h3>
45+
46+
</div>
47+
48+
<main>
49+
<p>Git has been around for a long time — since April 2005. That’s 20 years!
50+
Fun fact — <a href="https://en.wikipedia.org/wiki/GNU_Bazaar">Bazaar</a> and
51+
<a href="https://en.wikipedia.org/wiki/Mercurial">Mercurial</a> were released around the same time as Git.
52+
Not so fun facts — during this time
53+
<a href="https://www.atlassian.com/blog/bitbucket/sunsetting-mercurial-support-in-bitbucket">Atlassian removed the Mercurial support from Bitbucket</a>
54+
and <a href="https://discourse.ubuntu.com/t/phasing-out-bazaar-code-hosting/62189">Canonical retired Bazaar altogether</a>.
55+
Meanwhile, GitHub and GitLab are alive and well — safe to say, Git is here to stay.
56+
In fact, we might see <a href="https://git-scm.com/docs/BreakingChanges#_git_3_0">Git 3.0</a> soon — a new version for the new decade.</p>
57+
<p>But what about new features? Surely there’s something useful for day-to-day workflows, right?</p>
58+
<h1 id="switch-branches">Switch Branches</h1>
59+
<p><code>git checkout</code> does the trick — but it’s much more than a branch switching tool.
60+
Take a look at <a href="https://git-scm.com/docs/git-checkout">the <code>man</code> page</a>:</p>
61+
<blockquote>
62+
<p>Updates files in the working tree to match the version in the index or the specified tree.
63+
If no pathspec was given, <code>git checkout</code> will also update <code>HEAD</code> to set the specified branch as the current branch.</p></blockquote>
64+
<p>Kinda a mouthful, right?
65+
<code>git switch</code> is an alternative with a more focused scope.
66+
Take a look at <a href="https://git-scm.com/docs/git-switch">the <code>man</code> page</a>:</p>
67+
<blockquote>
68+
<p>Switch to a specified branch. The working tree and the index are updated to match the branch.
69+
All new commits will be added to the tip of this branch.</p></blockquote>
70+
<p>Simple and straightforward! To switch a branch (FYI — it auto-tracks remote branches):</p>
71+
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-console" data-lang="console"><span class="line"><span class="cl"><span class="gp">$</span> git switch BRANCH
72+
</span></span></code></pre></div><p>To create and switch a branch in one go:</p>
73+
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-console" data-lang="console"><span class="line"><span class="cl"><span class="gp">$</span> git switch --create BRANCH
74+
</span></span></code></pre></div><blockquote>
75+
<p>&#x2139;&#xfe0f; <code>git switch</code> is experimental from <a href="https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.23.0.adoc">v2.23</a> (August 2019),
76+
stable from <a href="https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.51.0.adoc">v2.51</a> (August 2025).</p></blockquote>
77+
<h1 id="push-branches">Push Branches</h1>
78+
<p>Attempting to push a local branch results in a helpful message:</p>
79+
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-console" data-lang="console"><span class="line"><span class="cl"><span class="gp">$</span> git push BRANCH
80+
</span></span><span class="line"><span class="cl"><span class="err">
81+
</span></span></span><span class="line"><span class="cl"><span class="err"></span><span class="go">fatal: The current branch BRANCH has no upstream branch.
82+
</span></span></span><span class="line"><span class="cl"><span class="go">To push the current branch and set the remote as upstream, use
83+
</span></span></span><span class="line"><span class="cl"><span class="go"></span><span class="err">
84+
</span></span></span><span class="line"><span class="cl"><span class="err"></span><span class="go"> git push --set-upstream origin BRANCH
85+
</span></span></span><span class="line"><span class="cl"><span class="go"></span><span class="err">
86+
</span></span></span><span class="line"><span class="cl"><span class="err"></span><span class="go">To have this happen automatically for branches without a tracking
87+
</span></span></span><span class="line"><span class="cl"><span class="go">upstream, see &#39;push.autoSetupRemote&#39; in &#39;git help config&#39;.
88+
</span></span></span></code></pre></div><p>Git advertising <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushautoSetupRemote">a new feature</a>? Amazing!
89+
Unfortunately, with all the noise these days, it&rsquo;s easy to miss.
90+
It does work though — changing the config instructs Git to set upstream on its own:</p>
91+
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-console" data-lang="console"><span class="line"><span class="cl"><span class="gp">$</span> git config --global push.autoSetupRemote <span class="nb">true</span>
92+
</span></span></code></pre></div><blockquote>
93+
<p>&#x2139;&#xfe0f; <code>push.autoSetupRemote</code> is available from <a href="https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.37.0.adoc">v2.37</a> (June 2022).</p></blockquote>
94+
<h1 id="compare-changes">Compare Changes</h1>
95+
<p><code>git diff</code> is good, but it can be better — especilly when it comes to the <em>move</em> kind of changes.</p>
96+
<p>There is <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-diffcolorMoved">a diff option</a> for this, disabled by default:</p>
97+
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-console" data-lang="console"><span class="line"><span class="cl"><span class="gp">$</span> git config --global diff.colorMoved <span class="nb">true</span>
98+
</span></span></code></pre></div><p>When configured, the diff output uses different colors to highlight moved content —
99+
magenta (<code>tput</code> color #5) instead of red (#1) and cyan (#6) instead of green (#2).
100+
Additions and deletions keep their usual red and green colors.</p>
101+
<p>The option accepts <a href="https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---color-movedmode">multiple modes</a>.
102+
<code>dimmed-zebra</code> might be a good one — it dims <em>moves</em>, which might be not super important most of the time.</p>
103+
<blockquote>
104+
<p>&#x2139;&#xfe0f; <code>diff.colorMoved</code> is available from <a href="https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.15.0.adoc">v2.15</a> (October 2017).</p></blockquote>
105+
<h1 id="restore-changes">Restore Changes</h1>
106+
<p>Restoring changes can be done with <code>git checkout</code> (as is switching branches and much more).
107+
Following the same idea behind <code>git switch</code>, <code>git restore</code> is a simpler alternative.
108+
Take a look at <a href="https://git-scm.com/docs/git-restore">the <code>man</code> page</a>:</p>
109+
<blockquote>
110+
<p>Restore specified paths in the working tree with some contents from a restore source.
111+
If a path is tracked but does not exist in the restore source, it will be removed to match the source.</p></blockquote>
112+
<p>To restore a file to its committed state:</p>
113+
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-console" data-lang="console"><span class="line"><span class="cl"><span class="gp">$</span> git restore PATH
114+
</span></span></code></pre></div><p>Also take a look at <code>--staged</code> and <code>--worktree</code> arguments when dealing with more complex scenarios.</p>
115+
<blockquote>
116+
<p>&#x2139;&#xfe0f; <code>git restore</code> is experimental from <a href="https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.23.0.adoc">v2.23</a> (August 2019),
117+
stable from <a href="https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/2.51.0.adoc">v2.51</a> (August 2025).</p></blockquote>
118+
<h1 id="whats-next">What’s Next?</h1>
119+
<p><a href="https://blog.gitbutler.com/how-git-core-devs-configure-git">The <em>How Core Git Developers Configure Git</em> article</a>
120+
from the GitButler folks is a great read — it explores which options might be worth to have enabled by default.</p>
121+
<p>New commands like <code>git switch</code> and <code>git restore</code> are easier for Git newbies to understand.
122+
Not everyone has been using Git for 15+ years and is familiar with all <code>git checkout</code> nuances.</p>
123+
<p>All in all, it’s amazing to see Git continue to grow and evolve. Here’s to the next 20 years!</p>
124+
125+
</main>
126+
127+
128+
<hr/>
129+
130+
<footer>
131+
<nav>
132+
<ul>
133+
134+
<li class="menu-left"><a href="/">Posts</a></li>
135+
136+
137+
<li class="menu-right"><a href="feed://arturdryomov.dev/index.xml">RSS</a></li>
138+
139+
<li class="menu-right"><a href="https://github.com/arturdryomov">GitHub</a></li>
140+
141+
</ul>
142+
</nav>
143+
144+
</footer>
145+
146+
147+
</body>
148+
149+
</html>
150+

sitemap.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
xmlns:xhtml="http://www.w3.org/1999/xhtml">
44
<url>
55
<loc>https://arturdryomov.dev/</loc>
6-
<lastmod>2023-08-01T00:00:00+00:00</lastmod>
6+
<lastmod>2025-10-17T00:00:00+00:00</lastmod>
7+
</url><url>
8+
<loc>https://arturdryomov.dev/posts/modern-git/</loc>
9+
<lastmod>2025-10-17T00:00:00+00:00</lastmod>
710
</url><url>
811
<loc>https://arturdryomov.dev/posts/python-foreign-functions-and-steam/</loc>
912
<lastmod>2023-08-01T00:00:00+00:00</lastmod>

0 commit comments

Comments
 (0)