Skip to content

Instantly share code, notes, and snippets.

@felisio
Created September 19, 2025 09:06
Show Gist options
  • Save felisio/9c4af5940bb4b9eab15773bdf6fe3ad6 to your computer and use it in GitHub Desktop.
Save felisio/9c4af5940bb4b9eab15773bdf6fe3ad6 to your computer and use it in GitHub Desktop.
git alias
[alias]
chb = checkout -b
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
type = cat-file -t
dump = cat-file -p
# stp
stp = ./git-helpers/git-stp
# pretty log
lg = log --graph --pretty='format:%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
lost = !"git fsck | awk '/dangling commit/ {print $3}' | git show --format='SHA1: %C(yellow)%h%Creset %f' --stdin | awk '/SHA1/ {sub(\"SHA1: \", \"\"); print}'"
promote = ./git-helpers/git-promote
# fixup
fixup = !sh -c 'git commit -m \"fixup! $(git log -1 --format='\\''%s'\\'' $@)\"' -
# rebase
rb = rebase
ri = rebase --interactive --autosquash
# working in progress commit
unwip = !"git log -n 1 | grep -q -c wip && git reset HEAD~1"
wip = !"git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m \"wip\" --no-verify"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment