Chris's Wiki :: blog/programming/GitAliasesIUse Commentshttps://utcc.utoronto.ca/~cks/space/blog/programming/GitAliasesIUse?atomcommentsDWiki2020-02-13T13:10:40ZRecent comments in Chris's Wiki :: blog/programming/GitAliasesIUse.By Leah Neukirchen on /blog/programming/GitAliasesIUsetag:CSpace:blog/programming/GitAliasesIUse:9298e0262a6259d46509187ec5768b725ab65884Leah Neukirchenhttps://leahneukirchen.org/<div class="wikitext"><p>A few nontrivial ones from my config (<a href="http://leahneukirchen.org/dotfiles/.gitconfig):">http://leahneukirchen.org/dotfiles/.gitconfig):</a></p>
<pre>
medit = "!git diff --name-only --diff-filter=U -z | xargs -0r grep -lZ '\<<<<<<<' | xargs -0ro vim '+/<<<<<<<'"
</pre>
<p>edits all files which contain merge markers.</p>
<pre>
madd = "!git diff --name-only --diff-filter=U -z | xargs -0r grep -LZ '<\<<<<<<' | xargs -0r git add -v"
</pre>
<p>adds all files which don't contain merge markers anymore.</p>
<pre>
sub = submodule update --init --recursive
</pre>
<p>does anything I ever need related to submodules in one call.</p>
<pre>
push-branch = push -u origin HEAD
</pre>
<p>pushes the current branch to origin, creating it if needed.</p>
</div>2020-02-13T13:10:40ZBy Piero on /blog/programming/GitAliasesIUsetag:CSpace:blog/programming/GitAliasesIUse:1839cbf54d7bf2c50bf260ecfc8d49240bc7840dPiero<div class="wikitext"><p>One of the most frequent actions on git repositories is looking at what I and others did. For this I use these aliases:</p>
<pre>
my = log --author=$LOGNAME
by = "!by() { cd ${GIT_PREFIX:-.}; whom=$1; shift; git log --author=$whom $@; }; by"
</pre>
<p>I have also found that looking at thing to be committed, was a frequent action, thus:</p>
<pre>
ss = "!ss() { git show 'stash@{'$1'}'; }; ss"
</pre>
</div>2020-02-12T21:20:08ZBy sapphirepaw on /blog/programming/GitAliasesIUsetag:CSpace:blog/programming/GitAliasesIUse:0eda189625ec6b6f450fd50430633cbca2362bcfsapphirepawhttps://keybase.io/sapphirepaw<div class="wikitext"><p>I don't remember where on StackOverflow (probably) I found this or what git version is required, but I have a pair of shell aliases:</p>
<pre>
alias ahead='git log --pretty=oneline --abbrev-commit $(git rev-parse --abbrev-ref --symbolic-full-name @{u})..'
alias behind='git log --pretty=oneline --abbrev-commit ..$(git rev-parse --abbrev-ref --symbolic-full-name @{u})'
</pre>
<p>This tells me what's in my local repo but not on upstream (ahead) and vice-versa (behind).</p>
<p>Before it fell unmaintained, I used <code>git-sh</code> a lot; now, I just have my most-used aliases from it in my <code>.zshrc</code> file. Plus some gentle enhancements like ahead/behind.</p>
</div>2020-02-12T15:16:53ZFrom 193.219.181.226 on /blog/programming/GitAliasesIUsetag:CSpace:blog/programming/GitAliasesIUse:dbb0dd6fca29f8b8fc2fc0f4e91410a710499829From 193.219.181.226<div class="wikitext"><p>One of my most used aliases is <code>new = !tig @{1}..</code> because <a href="https://github.com/jonas/tig">tig</a> makes it far easier to browse history than the flat 'git log' does.</p>
</div>2020-02-12T06:00:51Z