You are here

Integrating a Github Pull Request in the ROOT repository

Caution!!! Never use the Github interface to merge PRs!

Step by step intstructions

Now that we are clear about the most important message of this page (never use the "merge pull request" button on Github) we can start.

Prepare your .git/config file

Add to your .git/config file this section:

[remote "prs"]
        url = https://github.com/root-mirror/root.git
        fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

This will allow you to synchronise the PRs on the Github server in your local directory

Get all the Pull Requests on your local repository

Now, in order to get in sync with Github, run

-> git fetch prs

This should produce output like

remote: Counting objects: 5217, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 5217 (delta 2943), reused 2930 (delta 2930), pack-reused 2255
Receiving objects: 100% (5217/5217), 1.40 MiB | 762.00 KiB/s, done.
Resolving deltas: 100% (3930/3930), completed with 1169 local objects.
From https://github.com/root-mirror/root
 * [new ref]         refs/pull/10/head -> origin/pr/10
 * [new ref]         refs/pull/100/head -> origin/pr/100
 * [new ref]         refs/pull/101/head -> origin/pr/101
 * [new ref]         refs/pull/102/head -> origin/pr/102
 * [new ref]         refs/pull/103/head -> origin/pr/103
[...]

Add the commits of the Pull Request to the master branch

Now it's time to incorporate the changes into the master branch. The philosophy to be followed is the NoSY one.

git checkout pr/123
git fetch origin
git rebase origin
git checkout master
git pull
git merge --ff-only pr/123

Don't forget to run all tests now!

Get a single Pull Request on your local repository

git fetch prs pull/123/head:pr-123

And then

git checkout pr-123
git fetch origin
git rebase origin
git checkout master
git pull
git merge --ff-only pr-123

Don't forget to run all tests now!

Final Remark

Caution!!! Never use the Github interface to merge PRs!