1
0

forks.rst 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .. _forks:
  2. Forks
  3. =====
  4. A fork in Pagure is a copy of a repository. When contributing to a project on
  5. Pagure, the first step is to fork it. This gives you a place to make changes
  6. to the project and, if you so wish, contribute back to the original project.
  7. If you're not already familiar with Git's distributed workflow,
  8. `the Pro Git book has an excellent introduction
  9. <https://git-scm.com/book/en/v2/Distributed-Git-Distributed-Workflows>`_.
  10. You can see a list of projects you've forked on your home page.
  11. .. _create-fork:
  12. Create a Fork on Pagure
  13. -----------------------
  14. To fork a project, simply navigate to the project on Pagure and click
  15. the fork button. You will then be redirected to your new fork.
  16. .. _configure-local-git:
  17. Configure your Local Git Repository
  18. -----------------------------------
  19. Now that you have forked the project on Pagure, you're ready to configure a
  20. local copy of the repository so you can get to work. First, clone the
  21. repository. The URL for the repository is on the right-hand side of the
  22. project overview page. For example::
  23. $ git clone ssh://git@pagure.io/forks/jcline/pagure.git
  24. $ cd pagure
  25. After cloning your fork locally, it's a good idea to add the upstream
  26. repository as a `git remote <https://git-scm.com/docs/git-remote>`_. For
  27. example::
  28. $ git remote add -f upstream ssh://git@pagure.io/pagure.git
  29. This lets you pull in changes that the upstream repository makes after you
  30. forked. Consult Git's documentation for more details.
  31. Pushing Changes
  32. ---------------
  33. After you :ref:`configure-local-git` you're ready to make your changes and
  34. contribute them upstream. First, start a new branch::
  35. $ git checkout -b my-feature-or-bugfix
  36. It's a good idea to give the branch a descriptive name so you can find it later.
  37. Next, make your changes. Once you're satisfied, add the changes to Git's staging
  38. area and commit the changes::
  39. $ git add -A # add all changes
  40. $ git commit -s # prepare changes for upload
  41. Your text editor of choice will open and you can write your commit message.
  42. If you have not done so already :ref:`upload-your-ssh-key` now.
  43. Afterwards, you are ready to push your changes to your remote fork::
  44. $ git push -u origin my-feature-or-bugfix # upload changes
  45. In case you cloned the repo via HTTP, for example using a command like `git
  46. clone https://...`, the push will fail. Pagure.io does not support pushing
  47. over HTTP. An easy workaround is to use::
  48. $ git push -u origin my-feature-or-bugfix ssh://git@pagure.io/forks/jcline/pagure.git
  49. You are now ready to :ref:`open-pull-request`.