Umbraco CMS have recently moved their source code from CodePlex to Github which has triggered a flurry of contributions in the form of pull requests. Previously I had made a few small contributions to the project whilst on Codeplex and have now submitted some to Github.
Whilst GitHub is very easy to use and has excellent documentation I managed to get in a bit of a tangle trying to manage different issues, so mostly for my own future benefit, am noting two working processes here. If anyone else reads, first port of call should be the Umbraco contribution documentation and GiHub's own help pages on forking and pull requests.
One issue is that like other source control hosts, only one pull request can be submitted per branch. In order to keep things simple for the person on the other end, it makes sense not to combine several issues into one pull request.
Hence coding the first issue in master branch, pull requesting, and then trying to move onto a second in master branch will lead to problems. Really you'd have to wait until the first issue is accepted or rejected before working on a second issue in the same branch, which obviously isn't ideal.
Another issue is that, unlike Codeplex, you can only have one fork of a main repository - so you can't create a fork for each issue you work on.
Here are two methods to work around these two restrictions:
What To Do Right From The Start
This has been added to the Umbraco contribution page, so you can read it there under the section "When you're working on multiple issues at the same time".
Or Another Way... That I'm Currently Doing Given I Used Master Branch For My First Pull Request
Assuming you have a fork set up, and have cloned it locally, set up a remote of your fork called origin and one of the main repository called upstream
- Code and commit your work in your local master branch
Create a new branch based on the upstream master branch (or other branch if more appropriate
git branch [branch name] upstream/master
Pull out just the commit(s) you want into your branch that you will create the pull request from. You can find the SHA of each commit using the Git GUI interface.
git checkout [branch name] git cherry-pick [SHA of commit]
Push your changes to your fork
git push origin [branch name]
- Create a pull request from your branch into the master (or other if more appropriate) branch of the main repostory. It will now contain just the commits you want.