Even though I fix the merge conflicts (keeping staging and removing HEAD), next time I merge from my staging branch into master, the same conflicts happen, even though the code that is described as HEAD no longer exists on HEAD as I removed it last time.
What I don't understand, if I choose to keep the code changes from staging and commit them to master, then why, if I have not kept the 'changes' on master do they show up again next time I merge staging in to master? How can code on staging conflict with code on master that isn't there?
Presumably you have a situation where:
You can use git rerere (reuse recorded resolution) which will record the resolution when you resolve the merge conflict, and reuse it when it detects the same conflict. To do this, run:
git config --global rerere.enabled true
The next time you get a merge conflict, you should notice a line that looks like Recorded preimage for '<filename>', and when you commit the conflict resolution you should see Recorded resolution for '<filename>'.
Then, the next time you merge your branch in, git should say something like Resolved '<filename>' using previous resolution and apply the same fix you made last time automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With