How can I delete a file from git if it is inside a folder marked to be ignored by git. For example - /target/some_old_file.txt
was pushed to git before target
was added in .gitignore
is it possible without modifying the .gitignore file.
How can I delete a file from git if it is inside a folder marked to be ignored by git. For example - /target/some_old_file.txt
was pushed to git before target
was added in .gitignore
is it possible without modifying the .gitignore file.
To delete a file from git repo, you need to use
git rm --cached path/to/your/file
This means that git essentially forgets about the file in question. Please make sure to use --cached flag. Without the flag, the file will also be deleted from file system.
target
folder from .gitignore
.gitignore
to ignore the target
folder again.