Git can be cryptic sometimes and the documentation out there even more so. My team and I are faced with a very particular situation. For reference, we have a production ready master branch and a develop branch. Our branching strategy is as follows:
- branch off master to create feature branch
- merge feature into develop for integration and functional testing
- submit merge request to master when feature is done
One of the devs accidentally merged develop into his feature before merging it into master, so there was a bunch of unvetted code that went into feature as well. I reverted that merge to master, then the dev fixed his branch to remove all the unvetted code. However, when trying to merge his branch into master again, it threw an error. It seems to be because master already had the feature branch's history so it wouldn't accept it again.
What is the proper way to handle this situation.
P.S. - Trying to wrap my head around the difference between merging and rebasing. I understand that merge pulls in code changes and leaves everything else in tact, creating a new history for the commit. However, how does rebase work? My understanding is that it sets one branch to exactly the same state as another. Is this correct?