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 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.x
will compare origin/1.3.x against the current branch.