Multiple Git Fix Up Commits

Viewed 900

I would like to make a fixup commit against a previous commit. However that commit has already had a fixup commit made against it for another reason.

Should I make my new fixup against the last fixup commit, or can I still fixup against the original commit, essentially meaning I have 1 original commit and 2 fixup commits.

2 Answers

You can do either it shouldn't be an issue.

Situation you mentioned is similar to this one:

pick b7d9adb99 A
fixup 08bcd9b3d fixup for A
fixup 76014576b fixup for A
fixup 58ab94324 fixup for A

or this one:

pick b7d9adb99 A
fixup 08bcd9b3d fixup for b7d9adb99
fixup 76014576b fixup for 08bcd9b3d 
fixup 58ab94324 fixup for 76014576b 

So effectively it does not matter if you make fixup to 'main' commit or make 'fixup to fixup'. As a result, 'main' commit (in my case b7d9adb99) will include all of the fixup-changes and change its hash (in my case into 29074c0ec).

Related