0 votes
1 view
in Devops and Agile by (28.1k points)
edited by

I have cloned a project that includes some .csproj files. I don't need/like my local csproj files being tracked by Git (or being brought up when creating a patch), but clearly, they are needed in the project.

I have added *.csproj to my LOCAL .gitignore, but the files are already in the repo.

When I type git status, it shows my changes to csproj which I am not interested in keeping track of or submitting for patches.

How do I remove the "tracking of" these files from my personal repo (but keep them in the source so I can use them) so that I don't see the changes when I do a status (or create a patch)?

Is there a correct/canonical way to handle this situation?

1 Answer

0 votes
by (48k points)

There are 3 options to resolve I think for the question 3 options are required

Option1: 

To keep the local file for you, but delete for everyone once they try to pull 

git rm --cached <file-name> or git rm -r --cached <folder-name>

Option2: 

This is for optimization, like a folder with a large number of files, The assume-unchanged index will be reset and file(s) overwritten if there are upstream changes to the file/folder (when you pull).

git update-index --assume-unchanged <path-name>

Option 3: 

In this option you will tell git that you want your independent version of the file, you don’t want to overwrite production/config files.  

git update-index --skip-worktree <path-name>

Note: 

It will not propagate with git, and each user has to run it independently.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...