Skip to content

Instantly share code, notes, and snippets.

@KageKirin
Created February 27, 2019 03:08
Show Gist options
  • Select an option

  • Save KageKirin/c2aca484c8c663e33861621aac82b703 to your computer and use it in GitHub Desktop.

Select an option

Save KageKirin/c2aca484c8c663e33861621aac82b703 to your computer and use it in GitHub Desktop.
Git command aliases (.gitconfig entries)
[alias]
it = !git init && git commit --allow-empty -m \"initial commit [empty]\"
please = push --force-with-lease
commend = commit --amend --no-edit
commedit = commit --amend
ch = checkout
cb = checkout --branch
ps = push
psu = push --set-upstream
pl = pull
pr = pull --rebase
plr = pull --rebase --autostash
plm = pull --merge
pls = pull --ff-only
stsh = stash --keep-index
staash = stash --include-untracked
staaash = stash --all
ss = status --short --branch
ls = ls-files -m -- .
lsm = ls-files -m
lsu = ls-files -u
lsd = ls-files -d
lso = ls-files -o
lls = "!f() { for a in `git lsm`; do git ss | rg $a; done; for a in `git lsu`; do git ss | rg $a; done; for a in `git lsd`; do git ss | rg $a; done; }; f"
merc = merge --no-ff
merff = merge --ff
merffo = merge --ff-only
mt = mergetool
grog = log --graph --abbrev-commit --decorate --all --format=format:\"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)\"
rbi = rebase --interactive --autosquash --autostash
rbc = rebase --continue
rbabort = rebase --abort
safepull = pull --ff-only
hardpull = !git fetch $1 && git reset --hard $1/$2
softpull = pull --rebase --autostash
addi = add --interactive
ap = add --patch
chp = cherry-pick
chpn = cherry-pick --no-commit
unadd = reset HEAD --
xhp = cherry-pick -Xtheirs
xhpn = cherry-pick -Xtheirs --no-commit
uhp = cherry-pick -Xunion
uhpn = cherry-pick -Xunion --no-commit
fixup = "!f() { git commit -m \"fixup! $1\"; }; f"
squash = "!f() { git commit -m \"squash! $1\"; }; f"
oops = "!f() { git fixup `git rev-parse --short HEAD`; }; f"
oopsq = "!f() { git squash `git rev-parse --short HEAD`; }; f"
look = log --oneline
loo = "!f() { git log --oneline | cat; }; f"
loq = "!f() { git log --oneline | head; }; f"
unstage = reset HEAD --
cm = "!f() { git commit -m \"$*\"; }; f"
aac = "!f() { git add -- $* && git commit -m \"added $*\"; }; f"
tips = for-each-ref --sort=-committerdate --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
report = "!f() { pwd; git status $*; }; f"
ignore = "!f() { for a in `echo $*`; do echo $a >> .gitignore; done;}; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment