Last active
August 29, 2015 14:16
-
-
Save tschmidt/5eb824aaf2227899efbb to your computer and use it in GitHub Desktop.
gbin_gbout_scripts
This file contains hidden or 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
# | |
# I didn't write those, ;) all props go to http://stackoverflow.com/users/110735/clint-modien | |
# | |
# The following bash functions show you the difference in commits between the branch you are on | |
# and another branch that you either want to commit too or merge from. | |
# | |
# USAGE: | |
# gbout branch_i_want_to_push_too [-p, --raw] | |
# gbin branch_i_want_to_pull_from [-p, --raw] | |
# | |
# OPTIONS: | |
# -p shows full diffs with code | |
# --raw shows committed files | |
# | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
function gbin { | |
echo branch \($1\) has these commits and \($(parse_git_branch)\) does not | |
git log ..$1 --no-merges --format='%h | Author:%an | Date:%ad | %s' --date=local $2 | |
} | |
function gbout { | |
echo branch \($(parse_git_branch)\) has these commits and \($1\) does not | |
git log $1.. --no-merges --format='%h | Author:%an | Date:%ad | %s' --date=local $2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment