Skip to content

Instantly share code, notes, and snippets.

@czobrisky
Last active July 14, 2021 17:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save czobrisky/e9679eeaf2b78951679559d4506ee6a9 to your computer and use it in GitHub Desktop.
Save czobrisky/e9679eeaf2b78951679559d4506ee6a9 to your computer and use it in GitHub Desktop.
git config aliases
[branch]
autosetuprebase = always
[alias]
#one line log
l = log --pretty=format"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
#get current branch name, used later in other aliases
branch-name = !git rev-parse --abbrev-ref HEAD
publish = !git push -u origin $(git branch-name)
update = !git co master && git pull origin master
co = checkout
#checkcout create branch
cob = checkout -b
#checkout -- file = reset file
cof = checkout --
ci = commit
cm = commit -m
cam = commit -am
st = status
br = branch
unstage = reset HEAD --
last = log -1 HEAD
showfiles = show --pretty=\"format:\" --name-only
#list branches that have been merged into master
merged = branch --merged master
delete-merged = !git co master && git merged | grep -v '\\*' | xargs -n 1 git branch -d
amend = commit -a --amend
#list aliases with some color
la = "!git config -l | grep alias | cut -c 7- | grep --color=always -e '^.\\{1,10\\}=\\{1\\}'"
ss = stash save
sa = stash apply
sl = stash list
ssl = stash show -p
sd = stash drop
stashed = !git stash apply stash@{0} && git stash drop stash@{0}
rbr = !git rebase -i `git merge-base master HEAD`
ft = fetch --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment