One of my files is tracked twice after I changed the name of my folder.
Git is now tracking the following two files, which are actually the same file.
src/Website/scripts/common.js
src/Website/Scripts/common.js
How can I remove the second one from be tracked? This folder doesn't excist anymore, because I renamed it from Scripts
to scripts
.
Removing Files To remove a file from Git, you have to remove it from your tracked files (more accurately, remove it from your staging area) and then commit. The git rm command does that, and also removes the file from your working directory so you don't see it as an untracked file the next time around.
The Git rm –cached flag removes a file from the staging area. The files from the working directory will remain intact. This means that you'll still have a copy of the file locally. The file will be removed from the index tracking your Git project.
git rm --cached /src/Website/Scripts/common.js
git commit
--cached makes git refer to the versioned state, rather than the working tree.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With