1

For some reason I have untracked folders in my git branch that have nothing to do with my current directory. They seem to be mostly parallel directories.

I have no clue why but I've tried to use git ls-files --others --exclude-standard >> .gitignore and git clean -d -f -f.
Not sure if it is something up with my repo or what.

The only files that should exist are index.html and scripts.js

git status

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
ZST
  • 39
  • 1
  • 6

1 Answers1

1

Make sure you don't have a .git folder in the parent directory of the one including script.js.

If you do (and don't care about its history), remove it, then initialize a git repo in your current folder (where script.js is)

git init .
git status

Then you should see only your files, and not parent folders.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Thanks that was it! If you have a moment can you explain why this may have been the case? I guess I must have used git init before in the wrong directory? – ZST Dec 12 '18 at 05:57
  • @Zamir Yes: I suppose this was the case: a git init . done one folder above the one you wanted. – VonC Dec 12 '18 at 05:58