简体   繁体   中英

git commit and push to branch but not to pull request

I am working on a slideshow feature for an app and I create a branch off of main called slideshow . I know I have to submit a pull request to main directing it to pull from slideshow . In the pull request, conversation about certain aspects of slideshow delay the pull into main , but I still have to work on other aspects of slideshow for what will eventually be a separate pull request. So:

  • I want to be able to commit and push to slideshow without it being included in the pull request I submitted
  • But I also want to be able to go back and improve on the pull request for slideshow should code reviewers require improvements

Is there a way to push to a branch that's in pull request without pushing to that pull request? Or is the answer to this scenario to just create another branch off of slideshow ?

Pull requests always contain all commits from the branch to be merged, so no, there is no way to push to a pull-requested branch without pushing to the pull request. The best solution is probably to create a new branch off of slideshow . I would suggest creating a branch specifically for the pull request, eg slideshow-pr1 (future intermediate pull requests from slideshow could use branches slideshow-pr2 &c., before finally merging slideshow ); continue working on the slideshow in slideshow , and either cherry-pick commits from the original feature branch or commit directly to the pull request branch to improve the pull request, merging it back into the feature branch after the pull request has been merged into master .

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