I am using Visual Studio (Professional 2019) and the Git integration there through Git Changes. I have always been using TFS, but we have decided to use Git projects on new development. I have added some stuff to the .gitignore
file, like for ignoring the .vs
folder etc. And it seems to be working as long as things are not already added in before. So far, so good.
But now we are hitting an issue where we have different changes in files like launchSettings.json
and appsettings.Development.json
files as well as the App_Data
folder.
The problem I don't understand is that we all want these files to be controlled in Git, to exist in the repo. But we want to exclude local changes form ever being pushed anywhere.
So we found information about the .git/info/exclude
file. And that's great. But it does not seem to solve the problem, because once a file is controlled, we can't exclude our own changes to that file. It only applies when the files is not controlled at all. Here's where I'm not sure at all, but it seems that way.
When we used TFS control, we were able from Visual Studio to just right-click the file and choose "Exclude" and it would appear in the "Excluded changes" list and not being checked in with the changeset.
But that's not possible in Git. At least not from Visual Studio. The only options available are Undo changes in addition to Blame (Annotate) and Stage. But we don't want to undo our changes. We just want to push our changes without including the changes.
What am I doing wrong here? Please enlighten me. I'm clearly missing something here.