I recently made a mistake with my git merge strategy and didn't notice any errors in the results until I continued working on the project and made more commits. For brevity, suppose I have two branches, hotfix and new_feature . I did something like the following:
git checkout new_feature git commit -m "Commit to the feature branch" git checkout hotfix git pull origin new_feature
After the events above, other developers also committed a fix to the patch. Now we have a fix that we want to push, but cannot, because it contains incomplete work with functions.
I saw a lot of similar questions about this situation, but none of them correspond 100% (most of them are related to undoing the fix immediately after a bad load without first pressing. I went one step further and really borked.
Any walkthroughs on how I can fix this?
Thanks!
Edit: many other answers mention git reflog , so here is my modified copy. I changed the hashes and branch names according to my example above.
aaaaaaa HEAD@ {0}: checkout: moving from new_feature to hotfix bbbbbbb HEAD@ {1}: checkout: moving from hotfix to new_feature aaaaaaa HEAD@ {2}: commit: Added analytics tracking ccccccc HEAD@ {3}: commit (merge): Fixed a merge issue in compiled css # BAD MERGE? ddddddd HEAD@ {4}: checkout: moving from new_feature to hotfix eeeeeee HEAD@ {5}: commit: Finished updating the events for the header ddddddd HEAD@ {6}: checkout: moving from hotfix to new_feature ddddddd HEAD@ {7}: checkout: moving from new_feature to hotfix
In the previous question above, HEAD@ {3} looks like a failed merge. I was on the hotfix branch and pulled into the new_feature branch, which gave merge conflicts. I fixed them and pushed. What would I do to fix this?
source share