Skip to content

Instantly share code, notes, and snippets.

@jwill9999
Forked from Vadorequest/.gitconfig
Created December 10, 2019 08:31
Show Gist options
  • Save jwill9999/884e4d729ab2e4f2242de4f44f389901 to your computer and use it in GitHub Desktop.
Save jwill9999/884e4d729ab2e4f2242de4f44f389901 to your computer and use it in GitHub Desktop.
My own Git config
[push]
default = current
[alias]
fetch = git fetch --tags
st = status
ci = commit
co = checkout
br = branch
rz = reset --hard HEAD
unwip = reset HEAD^
pr = pull --rebase
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
wip = !git add --all && git ci -am "wip"
amend = !git add --all && git ci --amend
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"
ls = show --stat --oneline
rollback = reset --soft HEAD~1
rebase-and-delete = "!f() {\
if [ ! $1 ]; then exti 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"
# Delete all local branches but master and the current one, only if they are fully merged with master.
br-delete-useless = "!f(){\
git branch | grep -v "master" | grep -v ^* | xargs git branch -d;\
}; f"
# Delete all local branches but master and the current one.
br-delete-useless-force = "!f(){\
git branch | grep -v "master" | grep -v ^* | xargs git branch -D;\
}; f"
[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
[core]
editor = 'subl' --wait
trustctime = false
autocrlf = input
[fetch]
prune = true
[status]
showUntrackedFiles = all
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment