Created
July 6, 2017 08:13
-
-
Save ObiWahn/c436473ca53033fa925b4bc172f1e95e to your computer and use it in GitHub Desktop.
some aliases for your .gitconfig
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
[alias] | |
#https://github.com/seveas/git-spindle | |
##basic | |
treeall = "log --graph --pretty=oneline --decorate --abbrev-commit --all" | |
tree = "log --graph --pretty=oneline --decorate --abbrev-commit" | |
treelong = "log --graph --pretty='%C(yellow)%h %d %Cblue%ad %Cgreen%an %Creset%s ' --date=relative" | |
logall = "log --all --date-order" | |
stat = "diff --stat HEAD" | |
cat = "cat-file -p" | |
## basic funcitons | |
#show the last n people who commited on file | |
show-last = "!_git_fun() { git log \"$1\" |grep Author |awk ' !x[$0]++' |head -\"$2\"}; _git_fun" | |
#rest merge for single file | |
reset-merge-of-file = "!_git_fun() { if [ -f \"$1\" ]; then git merge-file -L HEAD -L BASE -L OTHER -p $(git unpack-file :2:\"$1\") $(git unpack-file :1:\"$1\") $(git unpack-file :3:\"$1\"); rm .merge_file_*; else echo 'you need to provide a file'; fi; }; _git_fun" | |
#github | |
githup-init = "!_git_fun() { \ | |
test -z \"$1\" && { echo 'usage: git github-init repo'; exit 1; }; \ | |
git remote add origin \"[email protected]:<your_user>/$1.git\"; \ | |
git push -u origin master; \ | |
}; _git_fun" | |
githup-init-user-repo = "!_git_fun() { \ | |
test -z \"$1\" -o -z \"$2\" && { echo 'usage: git github-init-user-repo user repo'; exit 1; }; \ | |
git remote add origin \"[email protected]:$1/$2.git\"; \ | |
git push -u origin master; \ | |
}; _git_fun" | |
githup-add-upstream-user-repo = "!_git_fun() { \ | |
test -z \"$1\" -o -z \"$2\" && { echo 'usage: git github-add-upstream-user-repo user repo'; exit 1; }; \ | |
git remote add upstream \"[email protected]:$1/$2.git\"; \ | |
}; _git_fun" | |
## function example | |
test = "!gitfun() { echo \"$1\n$2\"; }; gitfun" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment