2

Here is the situation: I have a Fork from a Original Repo (Upstream).

So according to the document from GitHub: https://help.github.com/articles/creating-a-pull-request , we need to create a new branch to work on a feature, then push it to my Fork. Then use Pull Request to ask for a merge into original repo.

I understand that. But if each feature deserves a branch, then I will have a hundred/thousand of temporary branches in my local machine (and in my fork).

I know that after my Pull Request is accepted, I can merge those temporary branches into my Develop branch, and delete the branches. Am I doing correctly? Is it a correct flow for using Git and Pull Requests?

  • Have a look at https://guides.github.com/introduction/flow/index.html – Tim May 21 '14 at 06:27
  • In general this is the recommended workflow with git. Although it's possible to have lots of feature branches, usually you wouldn't work on such a big number of features simultaneously. – Sascha Wolf May 21 '14 at 06:41
  • I don't quite see how you generate 'a hundred/thousand of temporary branches' if each is a distinct feature with a few hours work needed to make it worth pulling. Can you generate more than 10 finalised features each week? That is, you may have miss-estimated how to scope the feature branch sizes. Once the pull is accepted, you fetch the upstream and rebase your work onto it, with the accepted feature branch now 'disappearing' (empty), so you can delete it. – Philip Oakley May 21 '14 at 14:22
  • @PhilipOakley yes. In fact, we are developing WordPress Theme, thus there are many small features for the theme. One day, a developer can push several features to the repo (That increases the workload of integration guy who review code and accept the pull requests). If we do not create branches for features, one pull request will include a lot of code changes. – Ha Doan Ngoc May 22 '14 at 07:56

1 Answers1

1

It is the recommended workflow (meaning isolating each PR in its own branch).

The guide "Tidying up Pull Requests" does illustrate that you can delete a PR branch in one click.
No need to merge anything: once merged in the main upstream repo, your local clone should update master from upstream/master (with upstream being the name of the remote referring to the main repo, the one you have forked): see "Pull new updates from original Github repository into forked Github repository".
More tips at "git push to the forked repo; pull request to a parent branch"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250