Git · Middle · Question 69 of 75
How can you edit an older commit's content (not just its message) before pushing?
- 1Check out the commit and push it with
--force - ✓Correct answer: Mark it
editinrebase -i, amend, then--continue - 3Run
git commit --amendwith the old hash
Explanation
Rebase stops at that commit; change files, git commit --amend, and git rebase --continue replays the rest on top. Alternatively, make a --fixup commit and autosquash.