Created
April 23, 2020 07:09
-
-
Save grassdog/e1f414d84556c687a48dbfd4e2fc6ca6 to your computer and use it in GitHub Desktop.
Git aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
unstage = reset HEAD | |
# What's changed since last pull | |
news = log -p HEAD@{1}..HEAD@{0} | |
# Mark a repo as trusted | |
trust = "!mkdir -p .git/safe" | |
# List commits | |
ls = log --graph --pretty=format:"%C(yellow)%h%Cblue%d%Creset\\ %s\\ %C(green)\\ %an,\\ %ar%Creset" | |
# List with patches | |
ll = log --graph --pretty=format:"%C(yellow)%h%Cblue%d%Creset\\ %s\\ %C(green)\\ %an,\\ %ar%Creset" -p | |
# Log showing the graph | |
lg = log --all --graph --oneline --decorate | |
# Details of last commit | |
l1 = "!git ll -1" | |
# Grep | |
g = "!f() { git log -G$1; }; f" | |
gd = "!f() { git log -p -G$1; }; f" | |
# File log (diff details with commit log) | |
fl = log -u | |
# Diff a revision | |
dr = "!f() { git diff "$1"^.."$1"; }; f" | |
dtr = "!f() { git difftool "$1"^.."$1"; }; f" | |
# Fancy diff | |
fd = "!git diff --color $@ | /usr/local/share/git-core/contrib/diff-highlight/diff-highlight | less -R" | |
# List aliases | |
la = "!git config -l | grep alias | cut -c 7-" | |
# Safer pull | |
update = "!git remote update -p; git merge --ff-only @{u}" | |
# Wipe out current work (still creates a commit in the reflog) | |
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard | |
# Remove merged local branches | |
tidy = "!git branch --merged | grep -v '\\*\\|master\\|develop' | xargs -n 1 git branch -d" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment