logoalt Hacker News

prima-facietoday at 12:46 PM2 repliesview on HN

I found the following config to bring a great QoL improvement:

    FILE: .gitconfig
    ----------------
    [alias]
        ci = commit
        fix = commit --fixup
    [rebase]
        autosquash = true
Now you can do quick commits as save-points, and squash all of them at the end.

    git tag last-good
    git ci -am 'WIP'
    git fix HEAD -a
    git fix HEAD -a
    …
    git rebase -i last-good

Replies

OneDeuxTriSeiGotoday at 1:48 PM

It's not recommended because you can just use the --autosquash flag. No reason to make it the default.

especially since if you are rebasing you may want to rebase your changes from one branch to another (i.e. move to top of main or from on top of one feature to another).

So instead you can just do git rebase --autosquash -i last-good or just git rebase --autosquash and let it squash it down for you.

zahlmantoday at 2:16 PM

I just use `git commit --amend` and then there is nothing to squash.