1

I was working on branch-A, made code changes in a new folder, committed and pushed to origin.

Now I switched to branch-B (git checkout branch-B) and pulled from origin (git pull origin branch-B). However, the new folder that I made in branch-A appears in green on the file explorer (I'm using VScode) and there are 10 uncommited change in my VScode source control.

Now I'm afraid to make any commits to branch-B as it will include these new files I created on branch-A.

I would like to work on branch-B without carrying over changes I previously made to branch-A.

What have I done wrong?

Toms Code
  • 1,439
  • 3
  • 15
  • 34
  • 1
    Doesn't sound right to me. There must be something else wrong. Would you mind going into a bit more details? – iBug Oct 31 '19 at 17:02
  • 1
    Check your `.gitignore` file. Is it the same in both branches? – iBug Oct 31 '19 at 17:02

1 Answers1

0

Check first if there were a .git folder inside that new folder: it would be treated as a nested git repository, which might not be what you wanted.

Removing the nested .git subfolder, then adding/committing (as I mention here) should be enough.


The green+number could be a way to mention warning associated with the content of that folder.
So if there was no nested .git, that would simply mean that the new folder, when compiled in the context of your branch B, has warnings.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250