Skip to content

Instantly share code, notes, and snippets.

@haisi
Last active December 22, 2016 13:55
Show Gist options
  • Save haisi/85a90900eca799523def878425852f3b to your computer and use it in GitHub Desktop.
Save haisi/85a90900eca799523def878425852f3b to your computer and use it in GitHub Desktop.
Git Aliases
[core]
autocrlf = true
excludesfile = ~/.gitignore
[alias]
unstage = reset -q HEAD --
discard = checkout --
nevermind = !git reset --hard HEAD && git clean -d -f
uncommit = reset --mixed HEAD~
save = commit -m
resave = commit --amend
invert = revert
last = log -1 HEAD --format=format:"%Cred%H"
summary = status -u -s
graph = log --graph -10 --branches --remotes --tags --format=format:'%Cgreen%h %Creset• %<(75,trunc)%s (%cN, %ar) %Cred%d' --date-order
history = log -10 --format=format:'%Cgreen%h %Creset• %s (%cN, %ar)'
branchout = checkout -b
tags = tag
branches = branch -a
stashes = stash list
remotes = remote -v
prestage = diff -w --word-diff=color
precommit = diff --cached -w --word-diff=color --word-diff-regex='[^[:space:]<>]+'
move = mv
remove = rm
unmerged = branch --no-merged
unstash = stash pop
what = show -w
untrack = rm -r --cached
rewrite = rebase -i
amend = commit --amend
back = checkout "-"
contributors = shortlog -s -n
filetrail = git log --follow -p -w
mergetrail = log --ancestry-path --merges
unmerged = diff --name-only --diff-filter=U
aliases = !git config --get-regexp alias | sed 's/alias.//' | sed 's/ /: /' | sort
alias = !git config --get-regexp alias | sed 's/alias.//' | sed 's/ /: /' | sort
stats = shortlog -s -n --all --no-merges
remove-untracked = clean -df
undo = reset HEAD~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment