-1

I am facing a strange situation with GIT and I don't know how to explain it in detail, so that is why I am looking more for hints on how should I investigate it rather than an answer.

As I said, I don't have too much details about it, because I spotted it too late and I can say that I forgot what I did at the beginning(i.e. when I did the first checkout, because I tried a lot of checkouts after that).

The problem is that when I checkout to a branch(let's call it branch1) it seems that a lot of files are deleted and some are modified even if they exist on the remote branch1 . I did a git pull and it says that everything is up-to-date, but when I tried to checkout to any branch, those files are still missing. I really don't know how should I investigate this.

chelmertz
  • 20,399
  • 5
  • 40
  • 46
  • Start with `git diff --name-status branch1 branch2` – phd Apr 28 '20 at 21:18
  • I just run `git diff --name-status origin/master master` and it doesn't show anything. – Sam Stewart Apr 28 '20 at 21:22
  • Remember that you can also `git blame` to know who did what, and maybe ask them for more details. You might also find this useful: [commit exists on GitHub but not in my local clone](https://help.github.com/en/github/committing-changes-to-your-project/commit-exists-on-github-but-not-in-my-local-clone) – Daemon Painter Apr 28 '20 at 23:48

1 Answers1

0

Instead of investigate these stuff, most problems about branch switching are solved by perform a new clone for the desired branch (as soon as you already pushed your changed).

Go to other directory which doesn't contain your project and try to re-clone:

git clone -b branch1 https://github.com/username/project.git  
Ofek Hod
  • 3,544
  • 2
  • 15
  • 26