I have a config file which I want to keep on the remote repository, but I don\'t want to track its changes on my computer. Adding it to .gitignore doesn\'t do the trick.
<
You will need to do the combination of .gitignore file and git rm --cached. Use the following command :
git rm --cached filename.txt
This will remove the file from indexing but it will keep it in your repository and working area. After applying rm --cached you will need to commit the changes for it to take effect. It will show as Deleted in your tracked changes, but that's only because it has been deleted from indexing. Note: If you make changes to it again in future commits you will have to run: git rm --cached to untrack the changes to the file from the particular commit.