Skip to content

Instantly share code, notes, and snippets.

@particledecay
Created July 6, 2020 18:49
Show Gist options
  • Select an option

  • Save particledecay/99cdb91d04afa68249dc30008a8657e0 to your computer and use it in GitHub Desktop.

Select an option

Save particledecay/99cdb91d04afa68249dc30008a8657e0 to your computer and use it in GitHub Desktop.
My preferred Git(Hub) config
[alias]
co = checkout
ci = commit -S
st = status -s
br = branch
sui = submodule update --init
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
lg = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(b old yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
branch-name = rev-parse --abbrev-ref HEAD
upstream-name = !git remote | egrep -o '(upstream|origin)' | tail -1
head-branch = !git remote show $(git upstream-name) | awk '/HEAD branch/ {print $NF}'
pub = !git push -u origin $(git branch-name)
unstage = reset HEAD
rollback = reset --soft HEAD^
upstream-org = !git remote get-url $(git upstream-name) | cut -d: -f2 | cut -d/ -f1
create-pr = "!f() { hub pull-request -b $(git upstream-org):$1; }; f"
create-release = "!f() { hub sync && hub release create -e -m \"$(git since-last-tag)\" $1; }; f"
delete-merged = !git co $(git head-branch) && git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d
mkpatch = "!f() { git diff $1..$(git branch-name) > diff.patch && echo diff.patch; }; f"
tags = tag -l --sort=v:refname
last-tag = !git tags | tail -1
since-last-tag = "!f() { if [ -z \"$(git last-tag)\" ]; then git log --oneline --all; else git log --oneline $(git last-tag)..$(git branch-name); fi; }; f"
[user]
signingkey = YOUR_GPG_FINGERPRINT
name = FirstName LastName
email = your@email.com
[gpg]
program = gpg2
[push]
default = simple
[core]
editor = your_preferred_editor
pager = diff-so-fancy | less -FXRi
[color]
ui = auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment