user1417127
user1417127

Reputation: 1645

What's the best way to re-merge the feature branch to master after reverting in GIT

I have a feature branch called feature. I merged it to the master but then realize it's not ready to release yet, so I have to revert it to avoid blocking work of other people.

Note that I don't have permission to revert directly on master. To revert, I have to create a new branch feature_revert from master, revert the merge and merge this new branch to master again.

Now after a while and my changes are ready to merge again, what's the correct way to re-merge to master?

  1. Simply merge the feature branch to master again. Since I didn't revert directly on master, will Git be able to merge this or it will still recornize this branch as already merged?
  2. Revert the revert on feature_revert and merge it back to master
  3. Create a different branch feature_remerge, merge the change from feature to this new branch and merge this new branch to master

Sorry if I make things a bit complicated. Just want to know what's the best practice in this situation.

Upvotes: 1

Views: 84

Answers (1)

VonC
VonC

Reputation: 1324128

Simply merge the feature branch to master again.

That should not work indeed, since it was already merged as part of a PR.

Creating a new separate branch (option 3: feature_remerge) is the easiest way to proceed, in order for the right merge content to be merged to master.

Upvotes: 1

Related Questions