Skip to content

Instantly share code, notes, and snippets.

@nlfonseca
Last active September 24, 2022 00:02
git config (alias)
[user]
name = Nelson Fonseca
email = nelsonfonseca.18@gmail.com
editor = code
[core]
editor = vim
[color]
diff = true
[push]
default = simple
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[pull]
rebase = true
[alias]
# Add
ad = add
aa = add .
# Commit
cm = commit -m
ca = commit --amend -m
# Checkout
co = checkout
cb = checkout -b
# Cherry-pick
cp = cherry-pick
# Diff
df = diff
# List
tl = tag -l
bl = branch -a
rl = remote -v
# Status
st = status -s
#
pullop = !"git add .; git stash; git pull; git stash pop"
# Pull
pl = pull
plo = pull --rebase origin
plom = pull --rebase origin master
plog = pull --rebase origin gh-pages
plu = pull --rebase upstream
plum = pull --rebase upstream master
plug = pull --rebase upstream gh-pages
# Push
ps = push
pso = push origin
psom = push origin master
psog = push origin gh-pages
psu = push upstream
psum = push upstream master
psug = push upstream gh-pages
# Logs
l = log --pretty=oneline --decorate --abbrev-commit --max-count=15
ll = log --graph --pretty=format:'%Cred%h%Creset %an: %s %Creset%Cgreen(%cr)%Creset' --abbrev-commit --date=relative
# Sync
sync = plu && pso
todo = !"git ls-files | xargs find-todo-tags | awk -F: '{ print $1,$2; print $3,$4; print $5}' | grcat conf.todo-tags "
co = checkout
ci = commit
st = status
br = branch
ri = rebase --interactive --autosquash
rb = rebase
promote = !/usr/local/bin/git-promote
wtf = !/usr/local/bin/git-wtf
count = !git shortlog -sn
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
fru = !git fetch upstream
fo = !git fetch origin
fro = !git fetch origin && git rebase origin/master
fru = !git fetch upstream && git rebase upstream/master
stup = !git stash && git fro && git stash pop
type = cat-file -t
dump = cat-file -p
wip = !"git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m \"wip\""
unwip = !"git log -n 1 | grep -q -c wip && git reset HEAD~1"
head = !"git log -n1"
lost = !"git fsck | awk '/dangling commit/ {print $3}' | git show --format='SHA1: %C(yellow)%h%Creset %f' --stdin | awk '/SHA1/ {sub(\"SHA1: \", \"\"); print}'"
tags = !"git tag | sort -t . -k1,1n -k 2,2n -k 3,3n -k 2,2"
undo = !"git reset --soft HEAD^"
fixup = !sh -c 'git commit -m \"fixup! $(git log -1 --format='\\''%s'\\'' $@)\"' -
squash = !sh -c 'git commit -m \"squash! $(git log -1 --format='\\''%s'\\'' $@)\"' -
rank-contributers = !"git shortlog -s -n --no-merges"
open-unmerged = !git diff --name-only --diff-filter=U | xargs subl
up = "!git remote update -p; git merge --ff-only @{u}"
[filter "media"]
required = true
clean = git media clean %f
smudge = git media smudge %f
[filter "hawser"]
clean = git hawser clean %f
smudge = git hawser smudge %f
required = true
[filter "lfs"]
clean = git lfs clean %f
smudge = git lfs smudge %f
required = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment