Problem background
The company uses Code Cloud Enterprise Edition as a code hosting platform and uses master/dev branch classification for code management. The matser branch is a protection branch. It can only be reviewed and submitted and merged on the web page (request for review).
At this time, after the dev code is merged into the master, I found that there is a problem and I need to fall back. At this time, I can only click the back button at the request review. After the fallback, the master has not changed, but a new branch of revert_xxxx has been generated.
Existing problems
Newly generatedrevert_xxxxx
What branch is it? What does it have to do with the previous master/dev?
When re-merging after falling back, there was no change. How can I re-merge?
Questions and Answers
The newly generated branch (revert_xxxxx) is the new branch after the master branch falls back, including the revert operation. Since the master is a protection branch, there is no change on the master branch at this time. In other words, the fallback operation will not be executed directly on the master!
At this time, I want to re-merge the dev into the master, but I found that it cannot be merged because git's revert is not a real fallback operation, but deletes the last merged content (reverse submission), which means that the content of the last merged still exists. The revert operation just deletes the last merged content and re-submits it (reverse submission).
Problem solving
Directly merge the new branch (revert_xxxxx) into the master, and the master will have a fallback record, and then directly delete the revert_xxxxx branch.
Now there is a double branch of dev/master. The master has fallen back but cannot be re-merged. At this time, the master needs to be merged into dev, so that the dev also has this return record, and then return the dev again (revert record revert, which is equivalent to resubmitting). At this time, git will submit the reverse submission on the reverse submission record. This time, the content deleted by revert will be resubmitted back. At this time, a new operation record will be generated and the master will be merged again.
Summarize
After reverting, there will be no changes, but a new branch will be generated and merged.
The revert operation is equivalent to a reverse submission change, so even if the master branch code is newer than dev after revert, it cannot be submitted. At this time, the master is merged with dev, and the dev branch is reverted last time!
The above is personal experience. I hope you can give you a reference and I hope you can support me more.