Source From Here
Question
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. 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?
How-To
Just calling git rm --cached on each of the files you want to remove from revision control should be fine. As long as your local ignore patterns are correct you won't see these files included in the output of git status. Note that this solution removes the files from the repository, so all developers would need to maintain their own local (non-revision controlled) copies of the file.
To prevent git from detecting changes in these files you should also use this command:
What you probably want to do:
Question
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. 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?
How-To
Just calling git rm --cached on each of the files you want to remove from revision control should be fine. As long as your local ignore patterns are correct you won't see these files included in the output of git status. Note that this solution removes the files from the repository, so all developers would need to maintain their own local (non-revision controlled) copies of the file.
To prevent git from detecting changes in these files you should also use this command:
What you probably want to do:
沒有留言:
張貼留言