Skip to content

Instantly share code, notes, and snippets.

@ChaseFlorell
Last active April 30, 2021 22:18
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 ChaseFlorell/44eebb15832d1777d6da4d4e9c26c5b2 to your computer and use it in GitHub Desktop.
Save ChaseFlorell/44eebb15832d1777d6da4d4e9c26c5b2 to your computer and use it in GitHub Desktop.
Customized Git Config
[user]
name = MY NAME
email = MY.EMAIL@gmail.com
initials = ME
[branches]
default = master
[rebase]
autoStash = true
[alias]
co = checkout
st = status -s
stats = shortlog -sn --no-merges
lg = log --decorate --pretty=format:%h%x09%an%x09%ad%x09%s --no-merges
cleanup = "!git fetch --all && git branch --merged | grep -v \"\\*\\|master\\|main\\|develop\\|development\\|dev\\|release\\|vnext\\|$(git config branches.default)\" | xargs -n 1 git branch -d"
cleanup-unsafe = "!git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done"
cleanup-all ="!git cleanup && git cleanup-unsafe"
new = checkout -b
alias = config --get-regexp ^alias\\. # List all aliases.
ec = config --global -e # open .gitconfig in the default editor
update = "!function f {\nif [ -z \"$1\" ]; then\nread -rsn1 -p \"Use the default $(git config branches.default) branch? [Enter]\";echo\nif [[ $REPLY == '' ]];then\necho \"Rebasing origin/$(git config branches.default)\"\ngit pull --rebase origin $(git config branches.default)\nexit 0\nelse\necho \"No branch specified, aborting.\"\nexit 1\nfi\nfi\necho \"Rebasing origin/${1}\"\ngit pull --rebase origin ${1}\n}; f"
up = update
p = !git push --set-upstream origin `git symbolic-ref --short HEAD` #push whilst setting upstream to the same branch
firedrill = "!git add . && git commit -m 'FIRE' && git p" #commit and push your work in a hurry
new-bug = "!function f {\nINITIALS=\"$(git config user.initials)\"\ngit checkout -b users/${INITIALS}/bugfix/${1}\n}; f"
new-task = "!function f {\nINITIALS=\"$(git config user.initials)\"\ngit checkout -b users/${INITIALS}/task/${1}\n}; f"
nt = new-task
nb = new-bug
[commit]
verbose = true
gpgsign = true
[core]
excludesfile = ~/.gitignore_global
editor = code --wait
[diff]
tool = diff-merge
[merge]
tool = diff-merge
[difftool "diff-merge"]
cmd = code --wait --diff \"$LOCAL\" \"$REMOTE\"
[gc]
auto = 0
[help]
autocorrect = 20
[pull]
rebase = true
[fetch]
prune = true
[rerere]
enabled = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment