Skip to content

Instantly share code, notes, and snippets.

@iaurg
Created April 20, 2020 18:06
Show Gist options
  • Save iaurg/5676015e20ded9172116858d060d3b33 to your computer and use it in GitHub Desktop.
Save iaurg/5676015e20ded9172116858d060d3b33 to your computer and use it in GitHub Desktop.
Git alias boilerplate
me = config user.name
# Less verbose status
st = status -sb
# Checkout
co = checkout
# Checkout master
cm = checkout master
# Checkout staging
cs = checkout staging
# Checkout development
cd = checkout development
# Push master
pm = !(git push -u origin master)
# Push staging
ps = !(git push -u origin staging)
# Push development
pd = !(git push -u origin development)
# Syncronize local branchs with remote
fe = fetch origin
# Fork a branch
fork = checkout -b
# Complete pull (with submodules)
pull-sub = !(git pull && git submodule foreach git pull origin master)
# Pretty log
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# Remote commits ahead of mine
incoming = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' ..@{u})
# Remote commits ahead of local
outgoing = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' @{u}..)
# The missing command <3
unstage = reset HEAD --
# Undo modifications to a file
undo = checkout --
# Last 24 hours commits
standup = !(git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --since yesterday --author "$(git me)")
# Review commits before pushing
ready = rebase -i @{u}
# Branchs hier
hier = log --all --graph --decorate --oneline --simplify-by-decoration
# Create a package
package = !(GZIP=-9 tar --exclude=".git/" -zcvf ../$(basename "$PWD")_$(date +"%Y-%m-%d_%H-%M-%S").tar.gz *)
# Resolve conflict using ours
resolve-ours = !(grep -lr '<<<<<<<' . | xargs git checkout --ours)
# Resolve conflict using theirs
resolve-theirs = !(grep -lr '<<<<<<<' . | xargs git checkout --theirs)
# List committers
committers = !(git log | grep Author | sort | uniq -c | sort -n -r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment