3 ms·
Uhm, I do a lot of git rebase -i HEAD~2 where I just squash the commit on the latest or sometimes I need to reorder and move the fix commits in specific commits
by a1o 2y ago
Uhm, I do a lot of git rebase -i HEAD~2 where I just squash the commit on the latest or sometimes I need to reorder and move the fix commits in specific commits in Pars that multiple commits, which I then need to push force. Is this for a similar use-case? I am not familiar with fixup or how it works.
- mckn1ght 2y agofixup works with rebase if you add the -a flag for autosquash. try it and you’ll see the commits already reordered for you in the interactive menu. also you can write HEAD~2 as @^^ if you want to save a couple keystrokes!
- rom1v 2y agoNit: Or @~2 (@ is HEAD, so @^^ is HEAD^^).
- AlexCoventry 2y agoYou can also just press `c`, then `F`, in magit.
- hoten 2y agofixup lets you mark a change to be rolled back into a previous commit, without changing the history (yet). When you do `git rebase --autosquash` it then automatically moves those commits as `fixup` in the right places. It helps to queue up many fixups at once and only have a single rebase to do when you're done (or for reviewers to see just the changes in a review tool, not have to reassess the entire commit because you already rebased) btw you could be doing `git commit --amend` if you just want to add to the last commit.
- cryptonector 2y agoYes. This saves you having to `git rebase -i` or `git rebase --autosquash` to get the fixup to be "absorbed" into the commit it is meant to fix up.