Skip to content

Instantly share code, notes, and snippets.

@roelven
Created November 3, 2010 11:13
Show Gist options
  • Save roelven/660977 to your computer and use it in GitHub Desktop.
Save roelven/660977 to your computer and use it in GitHub Desktop.
Awesome git functions to check differentiation between branches
##
## Add awesome git functions to check differentiation between branches.
## Add this to your ~/.profile and reload with $ source ~/.profile
##
## See http://stackoverflow.com/questions/53569/how-to-get-the-changes-on-a-branch-in-git
##
function parse_git_branch {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function gbin {
echo -e "Branch ($1) has these commits and ($(parse_git_branch)) does not: \n"
git log ..$1 --no-merges --format='%h | Author: %an | %ad | %s' --date=local
}
function gbout {
echo -e "Branch ($(parse_git_branch)) has these commits and ($1) does not: \n"
git log $1.. --no-merges --format='%h | Author: %an | %ad | %s' --date=local
}
## Now use in any branch $ gbout master to see what's in this branch but is not
## in master, and vice versa
##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment