Skip to content

Instantly share code, notes, and snippets.

@roparz
Last active April 18, 2019 09:27
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 roparz/de0e662fb980bdd8284e to your computer and use it in GitHub Desktop.
Save roparz/de0e662fb980bdd8284e to your computer and use it in GitHub Desktop.
Git config
[alias]
st = status
ci = commit
co = checkout
br = branch
rz = reset --hard HEAD
unwip = reset HEAD^
pr = pull --rebase
pf = push --force-with-lease
cp = cherry-pick
oops = commit --amend --no-edit
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lgl = log --color --graph --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --no-merges
lgm = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lgml = log --color --graph --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
wip = !git add --all && git ci -m "WIP:wip"
amend = !git add --all && git ci --amend
erase = !git amend && git push -f
rmtag = "!f() {\
tag=$1;\
git fetch --tags;\
git tag -d ${tag};\
git push origin :refs/tags/${tag};\
}; f"
uptag = "!f() {\
tag=$1;\
git fetch --tags;\
git tag -d ${tag};\
git push origin :refs/tags/${tag};\
git tag ${tag};\
git push --tags;\
}; f"
fix = "!f() {\
orig=$(git rev-parse --abbrev-ref HEAD);\
branch=$1;\
git checkout -b ${branch};\
git add --all;\
git commit;\
git push --set-upstream origin ${branch};\
git checkout ${orig};\
}; f"
brm = "!f() {\
branch=$1;\
git branch -D ${branch};\
git push origin :${branch};\
}; f"
rebase-branch = "!f() {\
if [ ! $1 ]; then exit 0; fi;\
orig=$(git rev-parse --abbrev-ref HEAD);\
branch=$1;\
git pull --rebase;\
git checkout ${branch};\
git pull --rebase origin ${orig} || exit 0;\
git push -f;\
git checkout ${orig};\
git rebase ${branch};\
git push;\
git branch -D ${branch};\
git push origin :${branch};\
}; f"
ls = show --stat --oneline
undo = "!f() {\
git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}};\
}; f"
[credential]
helper = osxkeychain
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow
frag = magenta
old = red
new = green
[color "status"]
added = yellow
changed = green
untracked = cyan
[push]
default = simple
[core]
editor = nano
whitespace = trailing-space
autocrlf = input
ignorecase = false
[fetch]
prune = true
[remote "origin"]
fetch = +refs/tags/*:refs/tags/*
[help]
autocorrect = 1
[http]
sslverify = false
[status]
showUntrackedFiles = all
[pager]
diff = diff-so-fancy | less --tabs=4 -RFX
show = diff-so-fancy | less --tabs=4 -RFX
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[commit]
gpgsign = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment