Learn how to untrack a single file that has already been tracked in Git.
Suppose you have added all the files to the Git repository using the following command:
$ git add --all
Now you want to remove a single file from Git repository. You can do that by running the following command:
$ git rm --cached filename.txt
This command will remove the file from the local repository now you need to update the remote one:
$ git commit --all -m "removed filename.txt"
Or if you’re using git aliases you can just run:
$ gcam "removed filename.txt"
If you find this post useful, please let me know in the comments below.
Want to share this with your friends?