Skip to content

Instantly share code, notes, and snippets.

@thalescm
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thalescm/9e991ed7194c6a3b06a8 to your computer and use it in GitHub Desktop.
Save thalescm/9e991ed7194c6a3b06a8 to your computer and use it in GitHub Desktop.
[user]
name = <User Here>
email = <Email Here>
[credential]
helper = osxkeychain
[color]
ui = auto
grep = auto
interactive = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = green bold
changed = yellow bold
untracked = red bold
[advice]
pushNonFastForward = false
statusHints = false
[diff]
renames = copies
[merge]
stat = true
tool = opendiff
[mergetool]
keepBackup = false
prompt = false
[rerere]
enabled = 0
[core]
pager = less -r
[merge "ours"]
driver = true
[alias]
a = add -A :/
st = status
cm = commit -m
br = branch
df = diff --color --color-words --abbrev
lg = log --oneline --decorate
co = checkout
mg = merge --no-ff
ft = fetch origin
fpo = fetch -p origin
fp = fetch -p
ls-rm = ls-remote --heads
cl = clean -fdx
# pushing and checking
ps = push
pl = pull
pom = push origin master
pof = "!f() { git push --force origin $1; }; f" # usage: $ git pof master
po = push origin
pod = push origin develop
poi = push origin ios-develop
poa = push origin android-develop
pd = pull origin develop
ploi = pull origin ios-develop
ploa = pull origin android-develop
cod = checkout develop
coa = checkout android-develop
coi = checkout ios-develop
# positional aliases
# from: http://stackoverflow.com/a/3322412/429521
ro = "!f() { git checkout $1; git reset --hard origin/$1; }; f" # usage: $ git ro master
# deleting branch localy, remote and both
del = branch -D
delo = "!f() { git push origin :$1; }; f" # usage: $ git delo <branch>
delboth = "!f() { git del $1; git delo $1; }; f" # usage: $ git del master
prune = remote prune origin # updating local "remote" branches that do not are in remote anymore
# delall = "!f() { git branch | grep $1 | xargs -L -0 -J {} delboth {} ; }; f" # usage: git delall ios-bugfix (will delete all)
# alias bellow from http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
logk = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
logf = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lg = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
logm = log --merges --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
# alias bellow from http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
# rebase the commit - usage: git reb 3
rebi = "!f() { git rebase -i HEAD~$@; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment