Skip to content

Instantly share code, notes, and snippets.

@dmitry-stepanenko
Last active May 29, 2025 10:01
Show Gist options
  • Save dmitry-stepanenko/f6470fef6a36264cb67e11f3b74667e3 to your computer and use it in GitHub Desktop.
Save dmitry-stepanenko/f6470fef6a36264cb67e11f3b74667e3 to your computer and use it in GitHub Desktop.
git aliases
[alias]
pushfl = push --force-with-lease
l = log
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches
ch = checkout
cm = commit -m
acm = !git add . && git commit -m
rsft = reset --soft HEAD~1
rshd = reset --hard
rshd1 = reset --hard HEAD~1
pushu = ![[ $(git config "branch.$(git symbolic-ref --short HEAD).merge") = '' ]] && git push -u origin $(git symbolic-ref --short HEAD) || git push
uc = !git commit --amend --no-edit
ucn = !git commit --amend --no-edit --no-verify
ucp = !git commit --amend --no-edit && git push --force-with-lease
ucpn = !git commit --amend --no-edit --no-verify && git push --force-with-lease --no-verify
a = !git add --all
auc = !git a && git uc
aucn = !git a && git ucn
aucp = !git a && git ucp
aucpn = !git a && git ucpn
frb = "!f() { git fetch && git rebase origin/$1; }; f"
frbu = "!f() { git fetch upstream && git rebase upstream/$1; }; f"
msg-by-sha = !git log --format=%B -n 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment