Sometimes I miss the features from Mercurial which Git does not have. One of them is hg outgoing which "Show changesets not found in the specified destination repository or the default push location". Similar behavior could be achieved with
git log branchA..branchB, e.g to see outgoing commits:
git log origin/master..feature-branch.
One day I used that command for the branch with really long name. I just typed a few fisrt letters, pressed tab and branch name was auto-completed (I personally prefer fish shell, but it should also work for all other modern shells). I asked myself: "What if I am using bash and I don't have the auto-completion, but I also don't want to use
git branch and copy-and-paste branch name?".
The answer is to use
git rev-parse --abbrev-ref HEAD:
> git rev-parse --abbrev-ref HEAD feature-branch
I've created the alias for it:
git config --global alias.cb 'rev-parse --abbrev-ref HEAD'
where cb stands for current branch.
Now I can do following
git log origin/master..$(git cb)
Suddenly I found out that passing remote-branch is not needed and previous command could be simplified:
git log origin/master..