Last active
May 31, 2017 18:35
-
-
Save cezarneaga/4549000ca99cdae4383713227a073afe to your computer and use it in GitHub Desktop.
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
# This is Git's per-user configuration file. | |
[user] | |
# Please adapt and uncomment the following lines: | |
name = Cezar Neaga | |
email = hi@cezarneaga.eu | |
[branch] | |
autosetuprebase = always | |
[color "status"] | |
added = green | |
changed = yellow | |
untracked = cyan | |
[alias] | |
# list short log | |
ls = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%an]" --decorate --date=short | |
# list log with details | |
ll = log --pretty=format:"%C(yellow)%h%\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%an]" --decorate --numstat | |
# list all aliases | |
la = "!git config -l | grep alias | cut -c 7-" | |
# rename branch to done-branch | |
done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f" | |
pl = pull --rebase | |
s = status -s | |
ci = commit -m | |
a = add . | |
# edit commit message | |
ca = commit --amend | |
co = checkout | |
# see all branches | |
br = branch -ra | |
# diff a file that changed | |
diff = diff --word-diff | |
# conflict/merges | |
ours = "!f() { git co --ours $@ && git add $@; }; f" | |
theirs = "!f() { git co --theirs $@ && git add $@; }; f" | |
#list remotes | |
rem="!git config -l | grep remote.*url | tail -n +2" | |
#apply patch from other local repo | |
lap = "!f() { git --git-dir=$1 format-patch -k -1 --stdout $2 | git am -3 -k; }; f" | |
#open markdown files edited in last commit | |
last = "!gvim $(git show HEAD --format="" --name-only | grep -e .*md$ | xargs)" | |
#open just created markdown in working directory | |
newmd = "!gvim $(git status -s | awk {'print $2'})" | |
# initial empty commit | |
empty = "!git commit -am\"[empty] Initial commit\" --allow-empty" | |
# }}} | |
# convoluted aliases {{{ | |
# grep from root folder | |
gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f" | |
#rename branch tree to done- | |
done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f" | |
#add bitbucket remote | |
ra = "!f() { git remote add $1 https://bitbucket.org/$2.git; }; f" | |
# }}} | |
# worktree list {{{ | |
wl = worktree list | |
# undo from here http://megakemp.com/2016/08/25/git-undo/ | |
undo = "!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f" | |
# }}} | |
[core] | |
excludesfile = /Users/cezar/.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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment