Skip to content

Instantly share code, notes, and snippets.

@bymyslf
Last active October 12, 2022 08:28
Show Gist options
  • Save bymyslf/f0882207c5c783b263ecd410605ed78a to your computer and use it in GitHub Desktop.
Save bymyslf/f0882207c5c783b263ecd410605ed78a to your computer and use it in GitHub Desktop.
Useful git aliases
[alias]
co = checkout
sw = switch
st = status
unstage = reset HEAD --
last = log -1 HEAD
cln = clean -n
clf = clean -f
cli = clean -i
clfx = clean -fx
clfd = clean -fd
theirs = checkout --theirs
ours = checkout --ours
delrem = push origin --delete
po = pull origin
ph = push origin
phu = push --set-upstream origin
cob = checkout -b
ci = commit
cim = commit -m
cia = commit --amend
ciam = commit --amend -m
cian = commit --amend --no-edit
cima = commit -am
cfu = commit --fixup
master = !git sw master && git pull origin master
uda = checkout -- .
pl = pull origin
plr = pull origin --rebase
br = branch
fh = fetch
sh = stash
shm = stash push -m
shp = stash pop
sha = stash apply
rt = reset
ignore = update-index --skip-worktree
unignore = update-index --no-skip-worktree
ignored = !git ls-files -v | grep "^S"
prune = remote prune origin
prune-dry = remote prune origin --dry-run
rv = reset --hard HEAD~1
graph = log --oneline --decorate --graph --all
dfst = diff --staged
rth = rt --hard
lg = log -p
lgol = log --oneline
lol = log --color --graph --decorate --pretty=format:'%C(red)%h %Cgreen%cr %Cblue(%an)%C(yellow)%d%Creset %s' --abbrev-commit --all
lola = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all
phwl = push --force-with-lease
halp = reflog --date=iso # halp is more than help
prev = sw -
acm = !git add . && git commit -m
ud = restore --
swc = sw -c
rtoh = reset --hard ORIG_HEAD
rl = reflog
ap = add -p
aa = add .
ai = add -i
rbsh = rebase -i --autosquash
[merge]
tool = vscode
conflictstyle = diff3
[mergetool]
keepBackup = false
keepTemporaries = false
[help]
autocorrect = 20
[mergetool "vscode"]
cmd = "code --wait "
[diff]
tool = vscode
[difftool "vscode"]
cmd = "code --wait --diff "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment