From 3c4cd2801d0599aaa898d7bb5176cf5cb9a9f3b5 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: May 02 2018 13:30:42 +0000 Subject: doc: explain how to fetch a pull request locally When working with pull requests it is easy to use `git fetch` to get a single pull request locally. Explain how to do this before detailing how to edit the `.git/config` file for fetching all pull requests. Update the tip on the pull-request page to suggest `git fetch` to a local branch followed by a `git checkout` of the branch. --- diff --git a/doc/usage/pull_requests.rst b/doc/usage/pull_requests.rst index eaf4cfc..770c4a2 100644 --- a/doc/usage/pull_requests.rst +++ b/doc/usage/pull_requests.rst @@ -107,7 +107,26 @@ pushing it to your remote fork. Working with Pull Requests -------------------------- It's quite common to work with a pull request locally, either to build on top of -it or to test it. You can do this by editing your git configuration as follows. +it or to test it. You can do this easily using ``git fetch`` to download the +pull request followed by ``git checkout`` to work with it as you would any +local branch. The syntax for ``git fetch`` is: :: + + git fetch $REMOTE pull/$PR_NUMBER/head:$BRANCHNAME + +For example, if you have PR#1 which "adds support for foo" you might run: :: + + git fetch origin pull/1/head:add-foo-support + +Then you can work with the ``add-foo-support`` normally: :: + + git checkout add-foo-support + +.. note:: You may use ``/`` characters in your branch name if you want to group + your pull requests by the submitter name, bug number, etc. For + example, you could name your local branch ``user/add-foo-support``. + +If you want to allow working with all of your pull requests locally, you can do +so by editing your git configuration as follows. Locate your remote in the ``.git/config`` file, for example:: [remote "origin"] diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index 500590c..8c17f82 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -660,7 +660,7 @@ {% if pull_request %}

Pull this pull-request locally v

- +
{% endif %} {% endif %}