Skip to content

Instantly share code, notes, and snippets.

@eschultink
Created September 25, 2018 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eschultink/4c2bae6f34097d38b837efeda1210110 to your computer and use it in GitHub Desktop.
Save eschultink/4c2bae6f34097d38b837efeda1210110 to your computer and use it in GitHub Desktop.
Alias section of my .gitconfig
[alias]
# find when commits were merged
# USAGE:
# git find-merge <SHA-1> // when merged to current branch
# git find-merge <SHA-1> master // when merged to master
find-merge = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'"
show-merge = "!sh -c 'merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge'"
# pull and fast-forward ALL local branches
pull-all = !"for b in $(git for-each-ref refs/heads --format='%(refname)') ; do git checkout ${b#refs/heads/} ; git pull --ff-only ; done"
# list 10 most recent tags
tags-recent = !"git tag --list --sort=-refname |head -n 10"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment