Created
October 27, 2015 16:19
-
-
Save roelven/677c55137febb3eaca61 to your computer and use it in GitHub Desktop.
Useful Git stuff
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
## | |
## Add awesome git functions to check differentiation between branches: | |
## | |
## See http://stackoverflow.com/questions/53569/how-to-get-the-changes-on-a-branch-in-git | |
## | |
function parse_git_branch { | |
/usr/bin/git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
function print_branch { | |
if [ parse_git_branch ]; then | |
parse_git_branch | |
fi | |
} | |
function gbin { | |
echo -e "Branch ($1) has these commits and ($(parse_git_branch)) does not: \n" | |
/usr/bin/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" | |
/usr/bin/git log $1.. --no-merges --format='%h | Author: %an | %ad | %s' --date=local | |
} |
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] | |
st = status | |
ci = commit | |
co = checkout | |
br = branch | |
p = pull | |
pu = push | |
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; subl `f`" | |
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`" | |
unstage = "reset HEAD" | |
lol = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment