Git: Amending older commits
Lets say you need to make a change to a commit
OLD_COMMIT, but this is not the most recent. If you have neither pushed nor merged it, you can do this:
- Make a new commit now, with a message like "fix".
- Do a
git rebase -i OLD_COMMIT~
- In the editor window that opened, move the "fix" commit directly after the one you want to amend (so it should be the second from the top), and mark it as "fixup". Save the file.
- If there are conflicts, solve them, add them, and do
git rebase --continue
Your development team has a full backlog of feature requests, chores and refactoring coupled with deadlines? We are familiar with that. With our "DevOps as a Service" offering, we support developer teams with infrastructure and operations expertise.