pull_requests.rst 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. .. _pull-requests:
  2. Pull Requests
  3. =============
  4. Pagure uses the concept of pull requests to contribute changes from your fork
  5. of a project back to the upstream project. To contribute a change to a project
  6. you first open a pull request with original project. The project maintainer
  7. then merges the pull request if they are satisfied with the changes you have
  8. proposed.
  9. .. _open-pull-request:
  10. Open a Pull Request
  11. -------------------
  12. Before you can open a pull request, you need to complete the :ref:`first-steps`
  13. and :ref:`create-fork` of the project you would like to contribute to. Once
  14. you have a fork and you have pushed a `git branch <https://git-scm.com/docs/git-branch>`_
  15. containing one or more `commits <https://git-scm.com/docs/git-commit>`_, you are
  16. ready to contribute to the project. Navigate to the project's Pull Request page
  17. and click on the ``File Pull Request`` button.
  18. A dropdown menu should appear containing the git branches in your fork. Select the
  19. branch containing your changes. You will be taken to a page where you can customize
  20. the title of your Pull Request and its description. By default, this is populated
  21. using your commit message.
  22. Once you are satisfied with your title and description, click ``Create``.
  23. Congratulations! It is now up to the project maintainer to accept your changes by
  24. merging them.
  25. .. _update-pull-request:
  26. Updating Your Pull Request
  27. --------------------------
  28. It is likely that project maintainers will request changes to your proposed code
  29. by commenting on your pull request. Don't be discouraged! This is an opportunity
  30. to improve your contribution and for both reviewer and reviewee to become better
  31. programmers.
  32. Adding to your pull request is as simple as pushing new commits to the branch you
  33. used to create the pull request. These will automatically be displayed in the
  34. commit list for the pull request.
  35. Rebasing
  36. ^^^^^^^^
  37. You may encounter a situation where you want to include changes from the master
  38. branch that were made after you created your pull request. You can do this by
  39. `rebasing <https://git-scm.com/docs/git-rebase>`_ your pull request branch and
  40. pushing it to your remote fork.
  41. .. _working-with-prs:
  42. Working with Pull Requests
  43. --------------------------
  44. It's quite common to work with a pull request locally, either to build on top of
  45. it or to test it. Currently, the best way to do this is by adding a remote to your
  46. git repository and checking out the branch the pull request is based on. For example,
  47. suppose user ``jcline`` has opened a pull request on the ``pagure`` project. The
  48. pull request was created using the branch name ``doc-prs-locally``. You can work with
  49. the commit or commits in this pull request by doing::
  50. $ git remote add -f jcline https://pagure.io/forks/jcline/pagure.git # Add and fetch the remote
  51. $ git checkout jcline/doc-prs-locally
  52. You will now be in a "detached HEAD" state. If you want to build off this pull
  53. request, just create a local branch, add some commits, push it to your fork,
  54. and open your own pull request::
  55. $ git checkout -b better-docs
  56. $ git commit -m "Improve this documentation"
  57. $ git push -u origin better-docs