0

Quick question. A colleague has pushed a branch using sourcetree and named it task/something/something_else

Using git in a bash shell, I've done git fetch but am unable to check it out. I get the following error:

error: pathspec 'task/something/something_else' did not match any file(s) known to git.

How can I fix this?

wrdeman
  • 810
  • 10
  • 23
  • See if this helps: [Git fetch remote branch](https://stackoverflow.com/questions/9537392/git-fetch-remote-branch) – Jonathan Lonowski Nov 03 '17 at 16:13
  • 3
    Possible duplicate of [Git fetch remote branch](https://stackoverflow.com/questions/9537392/git-fetch-remote-branch) – Garrett Hyde Nov 03 '17 at 16:14
  • Thanks but that didn't work. I had a feeling the problem is caused by having 2 "/" in the branch name. Does that make sense? – wrdeman Nov 03 '17 at 16:18
  • What was the exact command you ran to get this error? Two slashes shouldn't be the cause. – Vasan Nov 03 '17 at 16:19
  • this is an existing repo i've been using for a while. `git fetch` followed by `git checkout task/something/something_else` – wrdeman Nov 03 '17 at 16:21
  • Try `git checkout --track origin/task/something/something_else`? – Vasan Nov 03 '17 at 16:23
  • So I tried that and get: `fatal: A branch named 'task/something' already exists` . It looks like there is a branch called task/something as well. – wrdeman Nov 03 '17 at 16:25
  • 2
    @wrdeman You can specify a different name for the local branch to avoid the collision – `git checkout -b something_else origin/task/something/something_else`. –– Refs (branches, tags, etc.) are stored on disk, under the `.git` directory, as `file`, `folder/file`, `folder/folder/file`, etc. Your repository already has `task/something` as a file, and the file system doesn't allow it to be a folder at the same time for `task/something/something_else`. – Jonathan Lonowski Nov 03 '17 at 16:31
  • @JonathanLonowski Thanks - that was it. Thanks all – wrdeman Nov 03 '17 at 16:35

0 Answers0