Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using git extension how do I merge my feature branch into the master branch without changing my feature branch?

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.

like image 347
GreenArrow Avatar asked Nov 08 '22 16:11

GreenArrow


1 Answers

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!

like image 55
GreenArrow Avatar answered Nov 15 '22 04:11

GreenArrow