0

For the same centralized git repository, I created 2 local repositories via git clone; after working for a while, I did git pull --all so by right the two local repositories are the same.

However, there's a discrepancy --

From working folder A, in git bash command prompt, I can see a remote branch 'athos/ticket-1234':

$git branch -r ... origin/athos/ticket-1234 ... 

and can check it out:

$git checkout athos/ticket-1234 Switched to a new branch 'athos/ticket-1234' branch 'athos/ticket-1234' set up to track 'origin/athos/ticket-1234'. 

While from working folder B, in git bash command prompt, I can not see the remote branch 'athos/ticket-1234', also can not check it out:

$git checkout athos/ticket-1234 error: pathspec 'athos/ticket-1234' did not match any file(s) known to git 

I'm curious, what could happened, how could I find the root cause, and solve the issue?

Note: we have a coding practice that after a feature branch is merged back into the master branch, the developer shall delete the branch. So athos/ticket-1234 could be deleted by me, but I'm not sure now, as it appears somewhere but disappeared somewhere else.

16
  • That checkout you are trying, you have already fetched before running it, right? Commented Feb 15, 2023 at 11:08
  • 4
    Probably, it's deleted.... and the repo where you saw it, has not had a git fetch --prune so it is still visible there. Commented Feb 15, 2023 at 16:03
  • 1
    Had been dotting the path to the answer for a while... was waiting for you to connect them. Glad you saw the light. Commented Feb 15, 2023 at 16:27
  • 1
    @eftshift0 when I read the question my first thought was: clone1, then branch deleted, then clone2, and pruning is off by default. I see you nailed it in the comments already and you might as well write up that answer for future readers. Commented Feb 15, 2023 at 16:53
  • 1
    This is not even a duplicate but an n-duple.... I am ok with it not being marked as a duplicate but won't write an asnwer for it. Thanks for the suggestion. Commented Feb 15, 2023 at 17:39

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.