<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[sjchapman.uk]]></title><description><![CDATA[sjchapman.uk]]></description><link>https://sjchapman.uk</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 13:43:29 GMT</lastBuildDate><atom:link href="https://sjchapman.uk/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Git Aliases]]></title><description><![CDATA[I'm a big fan of git aliases, and use some every day. If you're not familiar, then check them out.
Adding an alias is simple (XXX = the alias; YYY = the command it is an alias for):
git config --global alias.XXX YYY
The first alias to add, is an alia...]]></description><link>https://sjchapman.uk/git-aliases</link><guid isPermaLink="true">https://sjchapman.uk/git-aliases</guid><category><![CDATA[Git]]></category><category><![CDATA[tips]]></category><dc:creator><![CDATA[Sam Chapman]]></dc:creator><pubDate>Mon, 03 Jan 2022 20:45:16 GMT</pubDate><content:encoded><![CDATA[<p>I'm a big fan of git aliases, and use some every day. If you're not familiar, then check them out.</p>
<p>Adding an alias is simple (XXX = the alias; YYY = the command it is an alias for):</p>
<p><code>git config --global alias.XXX YYY</code></p>
<p>The first alias to add, is an alias that allows you to easily see your aliases:</p>
<pre><code>git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.aliases <span class="hljs-string">"config --get-regexp alias"</span>
</code></pre><p>Then there's some basic shortcuts to allow for more concise commands:</p>
<pre><code>git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.st status
git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.co checkout
git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.ci commit
git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.wl worklog
git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.br branch
</code></pre><p>Then there are some commands that make life a little easier:</p>
<pre><code>git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.aa <span class="hljs-string">"add ."</span>
git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.aaa <span class="hljs-string">"add --all"</span>
git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.new <span class="hljs-string">"push -u origin HEAD"</span>
git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.last <span class="hljs-string">"log -1 HEAD"</span>
git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.rh <span class="hljs-string">"reset --hard"</span>
git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.prune <span class="hljs-string">"remote prune origin"</span>
git config <span class="hljs-operator">-</span><span class="hljs-operator">-</span>global alias.logtree <span class="hljs-string">"log --graph --oneline --decorate --all"</span>
</code></pre><p>Then we can get bash involved and get some more complex custom commands in to the mix. I find it a lot easier to add these by hand to the <code>.gitconfig</code> file instead of fretting about escaping the commands properly.</p>
<pre><code>clear = !"git rh &amp;&amp; git clean -f"

com = "!sh -c \"bug=`git symbolic-<span class="hljs-keyword">ref</span> HEAD|sed s#refs/heads/##`; git <span class="hljs-keyword">commit</span> -m \\\"\\${bug}: $1\\\" <span class="hljs-meta">$2</span> <span class="hljs-meta">$3</span> <span class="hljs-meta">$4</span> <span class="hljs-meta">$5</span>\""

boom = !git aa &amp;&amp; git com \"$1\" &amp;&amp; git <span class="hljs-built_in">new</span> &amp;&amp; echo \"BOOM!!!\"

wipe = !git aaa &amp;&amp; git <span class="hljs-keyword">commit</span> -qm \"WIPE SAVEPOINT\" &amp;&amp; git <span class="hljs-keyword">reset</span> HEAD~<span class="hljs-number">1</span> <span class="hljs-comment">--hard</span>

maintain = !git prune &amp;&amp; git branch -vv | awk <span class="hljs-string">'{print $1,$4}'</span> | grep <span class="hljs-string">'gone]'</span> | awk <span class="hljs-string">'{print $1}'</span> | xargs git branch -D
</code></pre>]]></content:encoded></item></channel></rss>