Skip to content

Instantly share code, notes, and snippets.

@mctrl
Last active October 29, 2021 09:50
Show Gist options
  • Save mctrl/5dbb373fc49a984831d754a0b04e5e79 to your computer and use it in GitHub Desktop.
Save mctrl/5dbb373fc49a984831d754a0b04e5e79 to your computer and use it in GitHub Desktop.
a collection of all the alias I find interesting or useful to remember in git
alias = config --get-regexp alias
bisectstop = bisect reset
branchamendhistory = filter branch
branchcommitid = "!f() { git branch --contains $id; }; f"
branchcreate = checkout -b
branchdelete = branch -d
branchesshow = branch --all --verbose
branchwithfile = "!f() { git log --all --format=%H $name | while read f; do git branch --contains $f; done | sort -u; }; f"
c = commit -m
ca = commit -au -m
cfile = log --all
commitfindword = "!f() { git log --grep=\"$1\"; }; f"
commitmodifyfile = log --follow --
commitshowfiles = show --name-only
checkstage = diff --staged
configl = config --list --show-origin
erase = reset --hard HEAD
fetcho = fetch origin
fetchu = fetch upstream
findbugstart = bisect
gt = checkout
lastc = log -1 HEAD
lastcadd = commit --amend --no-edit
lastcundo = reset HEAD~
lg = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cD - %cr) %C(bold blue)<%an>%Creset'
m = merge
mc = merge --continue
ma = merge --abort
pl = pull
plr = pull --rebase
ps = push
psf = push --force
rbc = rebase --continue
rbhead = "!f() { git rebase -i HEAD~$1; }; f"
rbfrom = "!f() { git rebase -i $1; }; f"
showcdiff = "!f() { git log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' $1..$2; }; f"
showremotes = remote -v
st = status
stageparts = add --patch
#stashall = stash save -u
stashall = stash apply --include-untracked
stashlastdel = stash drop
stashdelall = stash clear
stashlist = stash list
stashunapply = "!git stash show -p | git apply -R"
tree = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches --all
yank = cherry-pick
unstage = reset HEAD --
unstagepatch = reset --patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment