Last active
June 23, 2020 15:55
-
-
Save obedparla/a56e828e34f8609a827fce4ec3ea5c30 to your computer and use it in GitHub Desktop.
My personal Git config that must have saved me hundreds of hours over the years.
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
[filter "lfs"] | |
process = git-lfs filter-process | |
required = true | |
clean = git-lfs clean -- %f | |
smudge = git-lfs smudge -- %f | |
[status] | |
showUntrackedFiles = all | |
# Sometimes a newly-added folder, since it's only one line in git status, can slip under the radar. | |
# https://git-scm.com/docs/git-config#git-config-statusshowUntrackedFiles | |
#A lot here is taken from: | |
#https://blog.scottnonnenberg.com/better-git-configuration/ | |
[alias] | |
prune = fetch --prune | |
# Because I constantly forget how to do this | |
# https://git-scm.com/docs/git-fetch#git-fetch--p | |
undo = reset --hard HEAD | |
undosoft = reset --soft HEAD^ | |
# Not quite as common as an amend, but still common | |
# https://git-scm.com/docs/git-reset#git-reset-emgitresetemltmodegtltcommitgt | |
stash-all = stash save --include-untracked | |
# We wanna grab those pesky un-added files! | |
# https://git-scm.com/docs/git-stash | |
glog = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' | |
# No need for a GUI - a nice, colorful, graphical representation | |
# https://git-scm.com/docs/git-log | |
# via https://medium.com/@payload.dd/thanks-for-the-git-st-i-will-use-this-4da5839a21a4 | |
co = checkout | |
com = checkout master | |
co2 = checkout @{-2} | |
s = status | |
a = add | |
aa = add -a | |
c = commit --verbose | |
ca = commit -a --verbose | |
cm = commit -m | |
cam = commit -a -m | |
m = commit --amend --verbose | |
mm = merge master | |
# Show the branches in DESC order from the last commit made on them | |
b = branch --sort=-committerdate | |
current = rev-parse --abbrev-ref HEAD | |
rewrite = !git rebase -i $(git merge-base master HEAD) | |
rebm = rebase master | |
rebmnow = !git com && git pull && git co - && git rebm | |
recon = !git add . && git rebase --continue | |
# Push force with lease (don't push if someone else pushed already) | |
please = push --force-with-lease | |
# Push new branch to master | |
pushu = push -u origin HEAD | |
[core] | |
excludesfile = /Users/obedmarquez/.gitignore | |
editor = idea --wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment