JLF
JLF

Reputation: 2360

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:

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?

Upvotes: 14

Views: 11207

Answers (1)

jbhannah
jbhannah

Reputation: 431

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.

Upvotes: 9

Related Questions