I have an App.Local.config file which each developer has their own settings in. I do not want this file checked versioned in the GIT repo as every time it would be overwritten by another developers changes.
So I deleted the file from the repo and added it to the ignore file. But now when developers switch branches, App.Local.config is deleted from their local filesystem.
Ultimately what i would like is:
How can I do that?
Thanks.
When you switch branches, files that are not tracked by Git will remain untouched. Since Git does not know about new_file.
gitignore applies to files in the folder that the . gitignore file is in; it does not matter which branch you currently have selected.
If you don't want Git to track certain files in your repository, there is no Git command you can use. (Although you can stop tracking a file with the git rm command, such as git rm --cached .) Instead, you need to use a . gitignore file, a text file that tells Git which files not to track.
What probably happened is that you removed the file from your workspace but not from the index. If you did that git thinks that removing this file is a change and it will remove it from then on.
The way to go is to remove the file you don't want to track anymore from the index with
git rm --cached App.Local.config
and then add that file to the .gitignore
Doing that you will have no more problems with the file
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