Skip to content

Instantly share code, notes, and snippets.

View philbert's full-sized avatar

Philip Cheong philbert

View GitHub Profile
@philbert
philbert / gfixup.md
Created February 22, 2019 13:27
The way git commit --fixup --autosquash should work

The way git commit --fixup --autosquash should work

I have an extremely useful alias that I use extensively in my git workflow:

alias gfixup="git commit --fixup HEAD && EDITOR=cat git rebase -i --autosquash HEAD~2 | sed '/^#/ d'"

What it does

Commits changes in the git index and auto-squashes the commit into the previous commit without opening $EDITOR!

The workflow

  1. git add .