Reputation: 1335
I have a Visual Studio solution with a number of projects, and I would like to add an additional project that is empty, and initially commit it so that all other developers will pull this project, but ignore subsequent changes to the both the project file, and the entire project folder by all developers. This project would contain code that can be specific to each developer's repository, and absorbed at runtime as needed by each specific developer, without the need to add/remove projects from the solution file nor maintain a second solution. Any further changes made by any developer to these files should not be committed.
.gitignore:
*
The above gitignore inside the project folder prevents any new additions from being added to the repository, however the references in the project file are still created and updated.
If the tracked sln file didn't need to reference the specific csproj, this wouldn't be an issue. I just wouldn't track the csproj in the first place.
My understanding of the solutions suggested in other questions (below) is that they are local, and the steps would need to be reproduced in each developer's repository, and again for every following repository instance. What is the best solution to achieve this across all pulled repositories if at all possible with git?
Similar Questions:
Upvotes: 4
Views: 1470
Reputation: 17111
Perhaps take a different approach, you could make use of git hooks and write some custom code to ensure that those files are either undone before a commit, or enforced on VSTS (perhaps) to make changes to those files.
More details on git hooks: https://www.visualstudiogeeks.com/DevOps/UsingGitHooksWithVstsGitOnWindows
Alternatively you could have a more manual approach, and developers can make changes to those files and via a Pull Request the files are peer code reviewed and branches are declined by your team's policy.
Upvotes: 0
Reputation: 1335
After extensive reading I believe this isn't possible currently with git. The answers here seem to cover the options that are available more completely than other questions I have encountered:
Keep file in a Git repo, but don't track changes
These proposed solutions really aren't adequate. The greater goal I am trying to achieve could be tackled with a solution dependency in Visual Studio. This however is also not supported as described here:
Visual Studio: How to make one solution depend on another?
Upvotes: 1
Reputation: 522712
Files in Git are either tracked/part of the repository or they are not. One option which came to mind is that you could add this project as a template. Then, your colleagues can copy whatever configuration they need for their local setup. Your original added project would only change rarely, perhaps for maintenance or migration. But each developer's local copy could be modified as needed.
Upvotes: 0