0

I was working on a feature branch locally, and added a new folder with a file in it. I then committed these new files along with my other changes and pushed to a remote server.

I am now working on a different feature branch from master; however the folder/file I added from the previous feature branch is showing in 'git status' as untracked and when I try to commit locally from my new feature branch, the folder stages itself for commit. I have tried to remove the folder using git clean -fd, but it then reappears when I am committing!

How do I deal with this untracked folder?

watermelon123
  • 357
  • 2
  • 3
  • 12

1 Answers1

0

If the file is committed when running git commit, it somehow got staged before.

To remove it from the staging area, run :

git reset folder/file

You should not see it anymore in your next

git commit

If it is not tracked and still present on your disk, and you know you want to delete it, just remove it with a regular rm.

LeGEC
  • 46,477
  • 5
  • 57
  • 104