Created
January 31, 2018 10:12
-
-
Save LucasRoesler/32ed9ebefe5cf269d45653e158cbf9a9 to your computer and use it in GitHub Desktop.
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] | |
# common operations | |
cp = cherry-pick | |
ci = commit | |
co = checkout | |
br = branch | |
undo-commit = reset --soft HEAD~1 | |
# sort branches by last update | |
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'" | |
# log as a graph | |
graph = log --graph --oneline --decorate --all | |
# one-line log | |
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short | |
# one-line log with list of files changed | |
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat | |
# set the upstream | |
sup = "!f() { git branch --set-upstream-to=$1/`git symbolic-ref --short HEAD`; }; f" | |
# cleanup old branches | |
audit = "!git branch --merged | grep -v '\\*\\|master\\|develop\\|release-'" | |
clean-audit = "!git branch --merged | grep -v '\\*\\|master\\|develop\\|release-' | xargs -n 1 git branch -d" | |
# squash the currently staged files into the previous commit | |
# note that if you have already pushed the branch, you will probably | |
# need to push with `git push -f` | |
fixup = "!git commit --amend" | |
# Thin out older metadata within the repository, reduceses filesystem footprint | |
trim = !git reflog expire --expire=now --all && git gc --prune=now | |
# list git aliases | |
la = "!git config -l | grep alias | cut -c 7-" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment