1

I have this history in the console:

Resolving deltas: 100% (58156/58156), completed with 1585 local objects. From bitbucket.org:interos/datavana * branch datavana.dev.py.3.7.3 -> FETCH_HEAD $ git checkout datavana.dev.py.3.7.3 error: pathspec 'datavana.dev.py.3.7.3' did not match any file(s) known to git $ git branch * alex/dockerize master $ git branch -a * alex/dockerize master remotes/origin/HEAD -> origin/master remotes/origin/master 

I noticed a problem when I tried running:

git checkout datavana.dev.py.3.7.3 

because as you can see that didn't work, and this branch is also not listed using git branch -a, anybody know why I can't checkout this branch?

2 Answers 2

2

If you take a look the top of your question, you see:

* branch datavana.dev.py.3.7.3 -> FETCH_HEAD 

This means that the remote reference datavana.dev.py.3.7.3 has been stored locally in FETCH_HEAD. It did not create a local branch with the same name.

You can create a local branch named datavana.dev.py.3.7.3 by running:

git checkout -b datavana.dev.py.3.7.3 FETCH_HEAD 

You probably ran git fetch <remote> datavana.dev.py.3.7.3, in which case what you see is the expected behavior. From the git-fetch man page:

The names of refs that are fetched, together with the object names they point at, are written to .git/FETCH_HEAD. This information may be used by scripts or other git commands, such as git-pull(1).

You would normally check out a remote branch using git checkout.

Sign up to request clarification or add additional context in comments.

3 Comments

yeah but why did it do the FETCH_HEAD thing, never seen that before?
Like I said, you didn't tell us what command you typed that resulted in that output. If you'd care to add that to your question, maybe we can figure out what happened.
yeah I just ran git fetch tmk
0

why did it do the FETCH_HEAD thing, never seen that before?
I just ran git fetch

Then double-check your git config remote.origin.fetch setting:
A default refspec should have created the local branch for you on fetch:

+refs/heads/*:refs/remotes/origin/* 

But if you have a different refspec, then the remote branch is fetched, and its reference is stored in FETCH_HEAD

A git fetch datavana.dev.py.3.7.3:datavana.dev.py.3.7.3 would also have created the branch locally.

Comments