I'm trying to remove my web.release.config from my GIT repository, so I removed it from git with git rm
and then added it to my .gitignore file.
But as soon as I copy again the file into the project, it gets added by Visual Studio to the pending changes.
This is the line in the gitignore file:
Web.Release.config
But it gets added:
How can I successfully remove web.release.config from git?
gitignore file tells Git which files to ignore when committing your project to the GitHub repository. gitignore is located in the root directory of your repo. / will ignore directories with the name.
Normally yes, . gitignore is useful for everyone who wants to work with the repository. On occasion you'll want to ignore more private things (maybe you often create LOG or something. In those cases you probably don't want to force that on anyone else.
The purpose of gitignore files is to ensure that certain files not tracked by Git remain untracked. To stop tracking a file that is currently tracked, use git rm --cached.
If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a .gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.
To ignore the files which we mentioned in the .gitignore file, we have to execute the following commands.
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
Please refer this question once.
This might not be a "proper" answer, but I think it's Visual Studio messing around. I've been experiencing the same problem with Visual Studio 2013 when I tried to exclude NuGet packages from the repository. git status
shows nothing, while VS still shouting that there're hundreds of files pending to be added. I ended up just use a Git Client (Git Extension, which is bundled with the git installation package) and ignore that Team Explorer tab in VS completely.
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