Question

I'm new to GitHub pull requests and wondering if this would work.

Right now I branch off master, make changes and commit periodically, then at some point I'll checkout master again and run git pull to get the latest from origin.

Next, I checkout my branch and call git rebase -i master to apply those changes and to make sure I don't have any conflicts when the time comes to merge back to master.

I'll go through that cycle periodically while working. When I'm ready to integrate to the master branch I checkout master and call git merge <my branch> then push to the repository.

But with pull requests do I need to take that last step? Instead, can I submit a pull request on my branch and then on GitHub apply it to master?

(I'm also open to improvements on my existing workflow, if any are apparent.)

Was it helpful?

Solution

with pull requests do I need to take that last step? Instead, can I submit a pull request on my branch and then on GitHub apply it to master?

  1. you should always submit a pull request from a branch that you have push to your GitHub fork.
  2. You even can rebase that branch on top of master, git push --force that branch to your fork, and your existing pull request will be updated. Automatically

The only merge of your branch to master will take place in the original repo by the main maintainer, should he/she chose to accept your pull request.

See more with couple of tips for pull requests.

OTHER TIPS

Yes, you certainly can submit a pull request on your branch and merge it to master in GitHub.

It will be best to do this when working with a Pull Request on a public repo where your changes will be reviewed before being merged back into the master of the repo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top