How do I update my local copy of a pull request?

Volker Simonis volker.simonis at
Thu Mar 4 15:44:15 UTC 2021


every PR request has the following instruction for downloading it locally:

$ git fetch pull/2570/head:pull/2570
$ git checkout pull/2570

That works well for the first time. But what do I have to do if the PR
was updated with more commits (or force-pushed with a new version).

While on the local branch "pull/2570" another "git fetch pull/2570/head:pull/2570" fails with:

fatal: Refusing to fetch into current branch refs/heads/pull/2570 of
non-bare repository

If I switch to another branch first (i.e. "git checkout master") the
second "fetch" completes successfully (but I have to switch back to my
pull/2570 branch afterwards).

Instead of issuing a second fetch command on my "pull/2570" branch, I
tried a simple "git pull" which returns:

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=<remote>/<branch> pull/2570

The first advice is good, because "git pull pull/2570/head" will indeed update my
branch. But the second advice (i.e. set tracking information for the
pull request branch) doesn't seem to work:

git branch --set-upstream-to=
error: the requested upstream branch
'' does not exist
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.

Doing a "git fetch pull/2570/head" as
advised succeeds, but unfortunately doesn't fix the problem with

So to cut a long story short, it seems the simplest way of updating
the local copy of a pull request is to run "git pull pull/2570/head". If this isn't
something totally obvious, maybe we could at it to the "Download"
information at the end of each pull request?

And there are still two remaining questions:

1. Why can't I set an upstream for the local pull request branch?

2. Why do all the instructions mention
"" instead of
"". This always gives me the warning
"warning: redirecting to". Might this
also cause other problems?

Thank you and best regards,

More information about the skara-dev mailing list