Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Does amending the initial commit of a branch change the merge base?

All of this was performed in Xcode and not terminal. I branched main to create the development branch. On development, I made a few tweaks and instead of committing them, I amended them. Now, when I attempt to merge development into main, I’m met with the error "no merge base found (-3)".

If instead of amending the changes, I commit them, there is no error. Should I have committed the changes instead of amending them to prevent this error? And did I receive this error as a fault of my own or should Xcode have been able to perform this merge?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Say git log development to learn the SHA of the amended commit (i.e. after it was amended) and say

git switch main
git rebase --hard <the-SHA>

This will point main at the same commit you amended. You will then be able to merge development into main (although there will be little point in doing so, because as far as I can tell from your question they are the same commit; either that or you’ll get a fast-forward, if you did more stuff than you have revealed in your question).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading