Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.