This is contingent upon GIT EXTENSION. I have code in a feature branch that I merged to the master branch. Since then my changes were removed and then another developer added parts of my code back into the master branch. How do I override those changes with a new branch with the complete code?
A caveat. The main source control person wants developers to first merge the master branch into the feature branch and then push the feature branch into master. In my case this erases the work in my feature branch and replaces it with the bad code.
I am posting part of Edvin's answer with some additions that I found to be true:
I would recommend checking out a new branch of the up-to-date version of master (temp-branch), merge your feature branch with the temp-branch and when the merge is completed as you want it, merge that temp-branch back into master. That way you are not taking any chances messing up the master branch.
You will find that you still have your remote branch out there and other branches if merged with those old changes out there too. Once you merge the temp-branch, delete the old branch. This takes care of partially the bad code merged into your branch. Make sure that your temp branch is now merged across all branches where the bad code is and viola!
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