• Chamomile 🐑@furry.engineer
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    10 months ago

    @Jesus_666 @JoYo Yeah, this. I actually use rebase as a way to restructure my commits more than I actually use it as a replacement for merge - I don’t think it’s an either-or proposition.

    One excellent use of this is using --fixup while working on a personal branch. If I’m working on a change and need to tweak something I wrote in a previous commit, I can use git commit --fixup <commit-hash> to earmark it for a later rebase. Then when I’m ready, I can git rebase -i --autosquash to do an interactive rebase, automatically squash the fixups with their corresponding commit and make any other changes as needed.

    This has some advantages over amend, namely that I can amend any commit in my branch rather than just the most recent one, and if I’m frequently pushing to trigger CI runs I can do that without constantly force pushing. (It still requires a force push at end, of course.)