0

I have a directory with a single file Foo.java defining a class under package com.a.b.c under a specific package i.e. src/com/a/b/c/Foo.java
I want to refactor and move the class in a different package e.g. com.x.y.x i.e. src/com/x/y/z/Foo.java
I did the refactor from inside the IDE I am using and that led to the git status showing:

src/com/a/b/c/Foo.java -> src/com/a/b/c/Foo.java

Now the issue is that the src/com/a/b/c is still there and empty.
I know that git has an issue with empty directories so now I am not sure how should I remove that? Should I do git rm -r src/com/a/b/c and commit everything at once? Or is there a better way?

Jim
  • 3,845
  • 3
  • 22
  • 47

1 Answers1

1

Git does not track directories, it tracks files. If you have moved everything away from src/com/a/b/c, you can just remove that directory from your working tree in any way you want, i.e. rmdir src/com/a/b/c - it has no effect on git whatsoever.

1615903
  • 32,635
  • 12
  • 70
  • 99
  • 1
    `ls` shows that `src/com/a/b/c` is there. `git rm src/com/a/b/c` outputs `fatal: pathspec 'src/com/a/b/c' did not match any files`. So basically it does not exist for `git` and I can just remove it using any OS command right? – Jim Jun 08 '21 at 08:26
  • 1
    Yes, exactly like that. – 1615903 Jun 08 '21 at 08:26