On Mon, Sep 19, 2016 at 6:58 AM, Paul Williamson
> We use git extensively on a number of repos. Recently, we have had a problem
> with one of them. This repo has a 'web_dev' branch. For copies of the repo
> cloned before a certain (recent but unidentified) time, we could 'git
> checkout' between master and web_dev and everything would be normal.
> However, now if we clone the repo, we can no longer do 'git checkout
> web_dev'. Git doesn't complain, in fact there is no feedback and we are still
> in the master branch. Running 'git branch -r' still shows the branch as
> existing at origin.
> If we try 'git branch web_dev' we then see web_dev listed locally and can
> switch to it BUT on closer inspection we realise that this action has created
> a new branch off master.
> The first time we saw this was under Bash on Windows, so we thought maybe it
> was a beta problem, but a) other repos work as expected under that
> environment, and b) under cygwin, pulling the same repo to a new directory
> alongside an older copy shows that the problem occurs with the new clone, but
> not the one that that was cloned longer ago.
> Also in this situation, there are no local outstanding code changes that
> might cause problems switching branches. This occurs right from a cleanly
> cloned repo.
> It seems something has gone wrong with this repo, and we don't know what.
> It's a tough problem to google, and I was not able to search the gmane
> archives (DNS errors).
> Any idea how to investigate?
Try a fresh clone with "git checkout --track origin/web_dev" and then
a "git status -v" and let us know what happens. I suspect that older
clones have the correct branches already setup for tracking, but the
new clone isn't doing it automatically, so when you run git checkout
web_dev you're just creating a new local copy.
You can probably fix this by running
git checkout web_dev
git branch --set-upstream-to=origin/web_dev
git reset --hard origin/web_dev
The last command will completely reset your local web_dev to match
what's upstream, and the second command tells git that this branch
tracks a given remote branch.
Hope this helps.