Last active
August 4, 2022 09:17
-
-
Save russHyde/c7537b58ed0126a1ecf4c15068d0a01b to your computer and use it in GitHub Desktop.
Get in-branch changes since separating from another git branch
This file contains 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] | |
biff = "!f() { \ | |
# all changes since branch/hash $2 separated from branch/hash $1 \ | |
old=${1:-main}; new=${2:-HEAD}; base=$(git merge-base ${old} ${new}); \ | |
git diff ${base} ${new}; \ | |
}; f" | |
[core] | |
editor = vim | |
[init] | |
defaultBranch = main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now calling
git biff
--> all changes between the current HEAD and the point where it diverged frommain
git biff someBranch
--> all changes between the current HEAD and the point where it diverged fromsomeBranch
git biff branch1 branch2
--> all changes on branch2 since it diverged from branch1Note that this is different from
git diff branch1 branch2
The latter gives all changes on branch2 relative to the current state of branch1.
Some other .gitconfig content is present for context