简体   繁体   中英

Sourcetree git flow finish feature to develop branch but develop branch is protected

I made a mistake. In Sourcetree I created a new feature branch starting from develop and made some changes. Afterwards I wanted to finish the feature and delete the feature branch. Sadly I forgot that the develop branch is protected and needs at least one review before being allowed to commit to it. Also I don't have the rights to circumvent this.

Now my feature branch is deleted and my changes can't be pushed.

How can I revert my mistake and eg get the feature branch back (or creating a new one) and creating a pull request instead of just finishing it instead?

The (anonymized) graph looks something like this: 在此处输入图像描述

Error while pushing: 在此处输入图像描述

My understanding is that you merged your feature branch into dev locally but you regret this and wish to perform the merge at the server side instead (by way of a pull request). No problem!

  1. Create a new feature branch from the "Fix" commit and push it (and ask for pull request at GitHub).

  2. Then hard reset your local dev to the commit before the merge (not shown in your screenshot), thus undoing the unwanted local merge.

    Or, even better, delete your local dev entirely, It serves no purpose, as you can never merge to it. and it leads you into errors like this one, To create a new branch in future, just fetch and then branch from origin/dev . That's what the professionals do!

(Both those things are quite easily done in Sourcetree, though personally I would use the command line.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM