Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 736
JLF Avatar asked Jul 30 '15 16:07

JLF


1 Answers

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, e.g. 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.

like image 142
jbhannah Avatar answered Nov 13 '22 14:11

jbhannah