Skip to content

Instantly share code, notes, and snippets.

@ilyar
Last active December 19, 2021 22:21
Show Gist options
  • Save ilyar/f7525ae608c278f8adf5 to your computer and use it in GitHub Desktop.
Save ilyar/f7525ae608c278f8adf5 to your computer and use it in GitHub Desktop.
Useful Git alias
[alias]
c = commit -m
a = add
mf = merge --ff-only
co = checkout
cob = checkout -b
ci = commit
st = status
br = branch
cp = cherry-pick
type = cat-file -t
dump = cat-file -p
ref = log -n 1 --pretty=format:%h --
hist = log --pretty=format:\"%Cblue%h%Creset %ad %Cgreen%s %Cred%an%n%d\" --graph --date=rfc
glog = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
ref = log -n 1 --pretty=format:%h --
branch-name = "!git rev-parse --abbrev-ref HEAD"
publish = "!git push --set-upstream origin $(git branch-name)"
aa = !git add -u && git add . && git status
rmb = delete-branch # https://github.com/tj/git-extras/blob/master/Commands.md#git-delete-branch
cleanup = !git remote prune origin && git gc && git clean -df && git stash clear
up = !git fetch --prune origin && git rebase origin/main --autostash
ir = !git rebase -i --autostash origin/main
hack = !br=${1:-$(git rev-parse --abbrev-ref HEAD)} && git checkout develop && git pull && git merge $br --no-ff -m \"Merge from $br\" && git push origin develop && git checkout $br
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment