0

git ls-remote origin lists all the remote with their commit IDs,

xxxx41   refs/heads/ABC
xxxx92   refs/heads/dummy_xyz
xxxx32   refs/heads/Feature/ABC
xxxx77   refs/heads/Feature/ABC-mgc

now when i checkout to any of the branch i get an error

error: pathspec "/Feature/ABC" or "/Feature/ABC-mgc" did not match any files known to git

i followed some questions on stack Remote branch not found

@schwern did wonderful explanation however i could not able to checkout.

cloudcop
  • 957
  • 1
  • 9
  • 15
  • In the provided answer, if fetch doesn't help, can you show your `checkout` command? Maybe you're accidentally prefixing the branch name with the `/` character... – TTT Jan 13 '23 at 16:12
  • What does `git branch --all` show? If `remotes/origin/Feature/ABC` is not listed, then [Yedidya Rashi's answer](https://stackoverflow.com/a/75111362/23118) is the solution. – hlovdal Jan 13 '23 at 18:21
  • @hlovdal git branch --all shows only two branches, "develop, remotes/origin/HEAD -> origin/develop & remotes/origin/develop – cloudcop Jan 13 '23 at 20:21

1 Answers1

1

Try to fetch the branches first:

git fetch
git checkout {the branch that you want}
Yedidya Rashi
  • 1,012
  • 8
  • 18