Working in a multi-branch system with git sometimes could become tricky to understand exactly what is/was going on in a particular branch.
Usually, at the moment of the code-review, I want to be able to understand what exactly happened since the branch was created from
master (or any other sub-branch). Using
git diff master isn't going to help, as it will list also the changes that in the meanwhile happened to the original branch.
In this case what is needed is a mixture of command, more or less like a pipe on your command line, first we need to get the reference on where the branch was created (
git merge-base HEAD master) and then use it with
git diff. The command to be piped as to be included by `` `.
git diff `git merge-base HEAD master`
You can add this command in your bash (or zsh) script or .gitconfig, as you prefer.
Keep in mind that if you are merging your original branch to the new one this command lose its power. But please it's a really nasty thing, don't do it, use
git rebase instead :)