Skip to content

Merging a Pull Request

drotter edited this page Nov 21, 2012 · 14 revisions

Merging a Pull Request

Create a testing branch

Create a new branch only for testing purposes from the pull requests target branch (develop in this sample). This branch should not be pushed to another repository!

git checkout -b [user]-[branch] develop

Get changes from Pull Request

Merge the changes of the pull request into our testing branch. You have to look up the URL to the users repository and the head branch he wants to merge.

git pull https://github.com/[user]/ZOOLU.git [branch]

Test the changes

Now test the pull request, and get it running correctly, if it is not doing already. Inform the contributor about bugs and other mistakes, so that he can correct them and commit the new changes. You can rerun the pull command from above to retrieve the new code. If you think the code is tested well enough and the user has commited all neccessary changes, you can delete the testing branch.

git branch -d prtest-1

Merge pull request

After testing the pull request you can merge it. Use the built-in automerge tool from github or merge the branch locally and push it to the upstream repository.

git checkout develop
git pull --no-ff https://github.com/[user]/ZOOLU.git [branch]
git push upstream develop

If the pull request is a hotfix branch, the changes has also to be merged into the master and a new release should be published.

git checkout master
git pull --no-ff https://github.com/[user]/ZOOLU.git [branch]
git tag -a v[version] -m "released v[version]"
git push upstream master
git push upstream v[version]

Note that you should sum up multiple simultaneous hotfixes to to one new release, as the release history gets cluttered otherwise.