1

This is only happening for me with my Java projects. I'm using Intellij but is the same with netbeans. These are the steps I've taken to remake this problem in a simple way. The folder structure I'm using is because of the requirements of my class.

  • Make clean github repo

  • mkdir classwork with a README.md

  • mkdir summatives with a README.md

  • create branch-one

  • create branch-two

  • push both to remote

  • checkout branch-two

  • Make a HelloWorld Maven project in classwork folder

  • add commit and push to branch-two

  • checkout branch-one

Now after switching to branch-one which should only have two empty folders there will still be my hello world project in the classwork folder. The project will be inaccessible sometimes being empty or with a few random files. Also looking on github branch-one is empty as expected.

Torrey
  • 11
  • 1
  • What does git status say? – tgdavies Sep 04 '21 at 01:55
  • Before switching every is up to date with a clean working tree. After switching sometimes it will be clean other times there will be some random files from the previous branch being tracked – Torrey Sep 04 '21 at 02:16
  • Are you running git commands from the command line as well as from within your IDE? That could cause your IDE caches to get out of sync with the file system. – Stephen C Sep 04 '21 at 02:25
  • I’m only using the command line as far as I know. Unless IntelliJ is doing something without me knowing – Torrey Sep 04 '21 at 02:30
  • So ... when you look at the file structure from the command line (e.g. using `ls`) do the stray files show up? (And what does `git status` say? Does it show them as files that should be added? – Stephen C Sep 04 '21 at 04:36
  • If these problems only show up when you are looking at the files in your IDE, then the problem is most likely that your IDE is out of sync. Look for the way to get your IDE to resync itself with the local file system. (Here's how for Eclipse: https://stackoverflow.com/questions/2518428) – Stephen C Sep 04 '21 at 04:40

0 Answers0