Hacker News new | past | comments | ask | show | jobs | submit login

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.



fixup 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!


Nit: Or @~2 (@ is HEAD, so @^^ is HEAD^^).


fixup 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.


Yes. 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.


You can also just press `c`, then `F`, in magit.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: