When you do that, just merge the main branch to the backend branch.
How to sync local branches after amending a commit that's already been pushed
I need help understanding what to do after updating a commit message that was already pushed to a remote branch.
Here's what happened:
-
I have two local branches: main (connected to origin/main) and backend.
-
I made a commit in backend, then merged it into main and pushed the changes.
-
Later, I realized I needed to fix a small typo in the commit message (changing an uppercase letter).
-
I used git commit --amend on main and then ran git push origin --force to update the remote.
-
After that, I tried to apply the same amendment on the backend branch to keep everything in sync, but ran into issues with the editor (it wouldn't open properly, so I had to cancel the process).
Now I'm confused by what I'm seeing in my Git graph — there's a Merge branch 'backend' commit, and things don't look clean or aligned anymore.
Here's a screenshot of what I see in my IDE: https://i.ibb.co/V0NnX0x7/git-screenshot.jpg
What I want to achieve: I want all three branches — main, origin/main, and backend — to point to the same final commit with the corrected message, and to clean up any unnecessary merge commits if possible.
I'm worried about breaking the history further, so any guidance on the safest way to proceed would be much appreciated.
Thanks in advance!
Please or to participate in this conversation.