Skip to content

Instantly share code, notes, and snippets.

@TechnoTone
Last active October 26, 2022 11:08
Show Gist options
  • Save TechnoTone/8afb945ef5932d498fecb6861120972e to your computer and use it in GitHub Desktop.
Save TechnoTone/8afb945ef5932d498fecb6861120972e to your computer and use it in GitHub Desktop.
git aliases
[alias]
st = status
s = status -s
f = !git fetch -a --tags && git status ;:
fp = !git fetch -a --tags && git pull
p = pull
ch = checkout
co = checkout
cm = checkout master
cb = checkout -b
d = diff -U0
diffall = diff HEAD -U0
staged = diff --staged -U0
a = add
stageall = add .
pick = add -p
unstage = reset -q HEAD --
discard = checkout --
undo = checkout --
undoall = checkout --force
c = commit
ac = !git add . && git commit -am
amend = commit --amend
amendnoedit = commit --amend --no-edit
ditto = "!f() { CMSG=$(git log -1 --format=format:'%s'); git commit -m \"$CMSG\";}; f"
wip = ac "WIP..."
uncommit = reset --mixed HEAD~
rebasemaster = "!f() { CBRANCH=$(git rev-parse --abbrev-ref HEAD); git cm && git fp && git co \"$CBRANCH\" && git rebase master; }; f"
aliases = !git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\:\\ /
branches = branch -a
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
remotes = remote -v
stashes = stash list
tags = tag
squash2 = rebase -i origin/master~2 master
squash3 = rebase -i origin/master~3 master
squash4 = rebase -i origin/master~4 master
squash5 = rebase -i origin/master~5 master
squash6 = rebase -i origin/master~6 master
squash7 = rebase -i origin/master~7 master
squash8 = rebase -i origin/master~8 master
squash9 = rebase -i origin/master~9 master
squash10 = rebase -i origin/master~10 master
g = log -10 --graph --branches --remotes --tags --format=format:'%Cgreen%h %Creset%<(75,trunc)%s (%C(Yellow)%cN%Creset, %Cblue%ar%Creset) %Cred%d' --date-order
graph = log -10 --graph --branches --remotes --tags --format=format:'%Cgreen%h %Creset%<(75,trunc)%s (%C(Yellow)%cN%Creset, %Cblue%ar%Creset) %Cred%d' --date-order
l = log -10 --format=format:'%Cgreen%h %Cblue%ar %Creset%s %C(Yellow)- %aN'
lg = log -10 --format=format:'%Cgreen%h %Cblue%ar %Creset%s %C(Yellow)- %aN'
search = log --format=format:'%Cgreen%h %Cblue%ar %Creset%s %C(Yellow)- %aN' -S
search-more = log --format=format:'%Cgreen%h %Cblue%ar %Creset%s %C(Yellow)- %aN' -p -S
regex = log --format=format:'%Cgreen%h %Cblue%ar %Creset%s %C(Yellow)- %aN' -G
regex-more = log --format=format:'%Cgreen%h %Cblue%ar %Creset%s %C(Yellow)- %aN' -p -G
whodunit = blame -wMC
sh = show -w -U0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment