-
-
Save sptq/43629bcc7c094911929a9082433b9b31 to your computer and use it in GitHub Desktop.
Some useful git aliases that I use
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] | |
# branches list | |
b = branch -vv | |
# branch name | |
branch-name = "!git rev-parse --abbrev-ref HEAD" | |
# checkout | |
c = checkout | |
# checkout bugfix | |
cb = !sh -c \"git checkout bugfix/$1\" - | |
# checkout feature | |
cf = !sh -c \"git checkout feature/$1\" - | |
# checkout hotfix | |
ch = !sh -c \"git checkout hotfix/$1\" - | |
# checkout new bugfix | |
cnb = !sh -c \"git checkout -b bugfix/$1\" - | |
# checkout new feature | |
cnf = !sh -c \"git checkout -b feature/$1\" - | |
# checkout new hotfix | |
cnh = !sh -c \"git checkout -b hotfix/$1\" - | |
# checkout master | |
cm = checkout master | |
# diff | |
dff = diff --color-words | |
# diff cached | |
dffc = diff --color-words --cached | |
# log | |
lg = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=relative | |
# log with files | |
lgf = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=relative --numstat | |
# merge master | |
mm = merge master --no-ff | |
# merge origin master | |
mom = merge origin/master --no-ff | |
# publish | |
pub = "!git push -u origin $(git branch-name)" | |
# status | |
s = status | |
# stash apply | |
sta = "!sh -c 'git stash apply stash@{$1}' -" | |
# stash apply newest | |
stan = stash apply | |
# stash drop | |
std = "!sh -c 'git stash drop stash@{$1}' -" | |
# stash list | |
stl = stash list | |
# stash pop | |
stp = "!sh -c 'git stash pop stash@{$1}' -" | |
# stash save | |
sts = !sh -c \"git stash save -u '$1'\" - | |
# tree | |
tree = log --graph --decorate --pretty=oneline --abbrev-commit | |
# undo | |
undo = "!f() { \\\n git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; \\\n}; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment