Last active
April 27, 2017 14:55
-
-
Save erenkabakci/769c7b46d695970589b3f00d23518253 to your computer and use it in GitHub Desktop.
.gitconfig
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
[core] | |
excludesfile = /Users/erenkabakci/.gitignore_global | |
[difftool "sourcetree"] | |
cmd = opendiff \"$LOCAL\" \"$REMOTE\" | |
path = | |
[mergetool "sourcetree"] | |
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" | |
trustExitCode = true | |
[pull] | |
rebase = true | |
[alias] | |
ci = commit | |
st = status | |
# e.g: git co branch-name | |
co = checkout | |
submodule-ignore-on = submodule -q foreach 'git config --file $toplevel/.gitmodules submodule.$name.ignore "all"' | |
submodule-ignore-off = submodule -q foreach 'git config --file $toplevel/.gitmodules --unset submodule.$name.ignore' | |
graph-old = !sh -c \"git log --graph --abbrev-commit --decorate --date=relative --format=format:\\\"%C(bold blue)%H%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)\\\" $*\" | |
prune-all = !git remote | xargs -n 1 git remote prune | |
# detail about the last commit | |
last-commit = !sh -c \"git log -1 --pretty=tformat:\\\"%H\\\" --author=\\\"`git config user.name`\\\" $*\" | |
# shorthand for alias creation | |
alias = "!sh -c '[ $# = 2 ] && git config --global alias.\"$1\" \"$2\" && exit 0 || echo \"usage: git alias <new alias> <original command>\" >&2 && exit 1' -" | |
clone-fork = "!sh -c \"[ $# = 3 ] && git clone $1 $3 && cd $3 && git remote add upstream $2 && git fetch upstream && git checkout -b upstream_master --track upstream/master && git co @{-1} && exit 0 || echo \\\"usage: git clone-fork <fork-repository> <upstream-repository> <directory>\\\" >&2 && exit 1 \"" | |
# log including files | |
lg-files = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat | |
# pretty, formatted log | |
lg = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph | |
lg-relative = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative | |
# branch naming (supports updating upstream, should be executed on the branch to be edited) e.g. git mb new-branch-name | |
mb = "!f() { oldbranch=$(git symbolic-ref --short HEAD); git branch -m "$1"; git push origin :$oldbranch "$1";}; f" | |
##### Alternatives ##### | |
#lg = !"git lg1" | |
#graph = !"git lg" | |
#lg1 = !sh -c \"git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' $*\" | |
#lg2 = !sh -c \"git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' $*\" | |
#lg3 = !sh -c \"git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)' $*\" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment