The first command ( git checkout refs/pull/1/head ) does not work, because refs/pull/1/head is the name of the link in the remote repository. You do not have a link to this name in your local repository, because your fetch refspec translated it to refs/remotes/origin/pr/1/head .
The second command ( git checkout origin/pr/1/head ) should work, although it should give you a "disconnected HEAD" warning. Was there a typo that you corrected when sending your question to "Stack Overflow"?
Your fetch refspec told git to translate remote links to local links in the refs/remotes . Links in this directory are specially processed - these are “remote links” designed to indicate the status of the remote repository the last time you did fetch . Usually you do not want to directly check these links - you want to create a local branch configured to “track” or “track” the remote link (which allows you to use special convenient combinations, such as the version parameter @{u} and easier push / pull ).
Try:
git checkout -b whatever-branch-name-you-want origin/pr/1/head
The above creates a new local branch named whatever-branch-name-you-want (I recommend calling it pr/1/head ), pointing to the same latch as origin/pr/1/head , setting up whatever-branch-name-you-want to track origin/pr/1/head , and then switch to a new branch.
source share