Create a pull request (PR)
Estimated reading time: 3 minutesA pull request (PR) sends your changes to the Docker maintainers for review. You
create a pull request on GitHub. A pull request “pulls” changes from your forked
repository into the docker/docker
repository.
You can see the list of active pull requests to Docker on GitHub.
Check your work
Before you create a pull request, check your work.
-
In a terminal window, go to the root of your
docker-fork
repository.$ cd ~/repos/docker-fork
-
Checkout your feature branch.
$ git checkout 11038-fix-rhel-link Switched to branch '11038-fix-rhel-link'
-
Run the full test suite on your branch.
$ make test
All the tests should pass. If they don’t, find out why and correct the situation.
-
Commit and push any changes that result from your checks.
Rebase your branch
Always rebase and squash your commits before making a pull request.
-
Checkout your feature branch in your local
docker-fork
repository.This is the branch associated with your request.
-
Fetch any last minute changes from
docker/docker
.$ git fetch upstream master From github.com:docker/docker * branch master -> FETCH_HEAD
-
Start an interactive rebase.
$ git rebase -i upstream/master
-
Rebase opens an editor with a list of commits.
pick 1a79f55 Tweak some of the other text for grammar pick 53e4983 Fix a link pick 3ce07bb Add a new line about RHEL
-
Replace the
pick
keyword withsquash
on all but the first commit.pick 1a79f55 Tweak some of the other text for grammar squash 53e4983 Fix a link squash 3ce07bb Add a new line about RHEL
After you save the changes and quit from the editor, git starts the rebase, reporting the progress along the way. Sometimes your changes can conflict with the work of others. If git encounters a conflict, it stops the rebase, and prints guidance for how to correct the conflict.
-
Edit and save your commit message.
$ git commit -s
Make sure your message includes your signature.
-
Force push any changes to your fork on GitHub.
$ git push -f origin 11038-fix-rhel-link
Create a PR on GitHub
You create and manage PRs on GitHub:
-
Open your browser to your fork on GitHub.
You should see the latest activity from your branch.
-
Click “Compare & pull request.”
The system displays the pull request dialog.
The pull request compares your changes to the
master
branch on thedocker/docker
repository. -
Edit the dialog’s description and add a reference to the issue you are fixing.
GitHub helps you out by searching for the issue as you type.
-
Scroll down and verify the PR contains the commits and changes you expect.
For example, is the file count correct? Are the changes in the files what you expect?
-
Press “Create pull request”.
The system creates the request and opens it for you in the
docker/docker
repository.
Where to go next
Congratulations, you’ve created your first pull request to Docker. The next step is for you learn how to participate in your PR’s review.
contribute, pull request, review, workflow, beginner, squash, commit