Definitely handy – I’ve added them to my .gitconfig. (note the double-encoded ampersands should simply be & instead of &)
UPDATE: Here is a Gist with some of my favorite alises – including incoming and outgoing that will use the currently checked out branch against the matching origin branch (no longer hard coded to master):
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [alias] | |
| up = "pull –rebase" | |
| pullmerge = "pull –no-rebase" | |
| subup = "!f() { git submodule sync; git submodule update –init –recursive; }; f" | |
| subreset = "submodule foreach 'git reset –hard HEAD'" | |
| who = shortlog -s — | |
| lg = log –graph –pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' –abbrev-commit –date=relative | |
| info = remote -v | |
| incoming = !(git fetch –quiet && git log –pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' ..@{u}) | |
| outgoing = !(git fetch –quiet && git log –pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' @{u}..) |
This post is part of the thread: Version Control – an ongoing story on this site. View the thread timeline for more context on this post.
Cool trick.
I hardly ever use the master branch in my projects, so having origin/master hardcoded there is not too useful to me. I modded these aliases to accept a branch name argument:
incoming = "!f() { git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d %Creset %s %C(white)- %ar%Creset' ..origin/$1; }; f"
outgoing = "!f() { git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d %Creset %s %C(white)- %ar%Creset' origin/$1..; }; f"
Use:
git incoming 1.3.xwill compare origin/1.3.x against the current branch.