After fork the warehouse, after git push, it is found that there is a file omission/file modification error, and I want to cancel the push submission, what should I do?

Sometimes the mr you mentioned is called back by the person who reviewed the code and cannot be combined with the main warehouse, and you have already pushed a submission under your fork warehouse. At this time, you need to cancel the submission of your own fork warehouse.
Method one:
git reset --soft <version number>
//Note that using the --hard parameter will discard the modification of the current workspace
//If you use the --soft parameter, it will fall back to the previous version, but keep the modification of the current workspace , You can resubmit
git push origin <branch name> --force
Note that there is a pit, you may use --force to report a reject error, because your authority is not enough.
Generally in the work process, sometimes your authority It cannot be changed arbitrarily, so this method cannot be used at this time.
Method 2: Re-fork the warehouse.
First delete the warehouse that you have already forked, and then click the fork button in the upper right corner to fork again. At this time, the branch submission record of your warehouse is the same The main repository is consistent and
reproduced in "Deleting the fork project on gitLab",
but these two methods are actually more troublesome. If there are other good methods, please leave a message in the comment area! (*^-^*)

Guess you like

Origin blog.csdn.net/qq_36875803/article/details/110598947