如何停止跟踪并忽略对Git中文件的更改? - How to stop tracking and ignore changes to a file in Git?

08/07 01:32
阅读数 47

问题:

I have cloned a project that includes some .csproj files. 我已经克隆了一个包含一些.csproj文件的项目。 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. 我不需要/不喜欢我的本地csproj文件被Git跟踪(或在创建补丁时显示),但是显然在项目中需要它们。

I have added *.csproj to my LOCAL .gitignore , but the files are already in the repo. 我已经将*.csproj添加到我的LOCAL .gitignore ,但是文件已经在仓库中。

When I type git status, it shows my changes to csproj which I am not interested in keeping track of or submitting for patches. 当我输入git status时,它显示了我对csproj更改,我对跟踪或提交补丁不感兴趣。

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? 有没有正确/规范的方法来处理这种情况?


解决方案:

参考一: https://stackoom.com/question/3vYn/如何停止跟踪并忽略对Git中文件的更改
参考二: https://oldbug.net/q/3vYn/How-to-stop-tracking-and-ignore-changes-to-a-file-in-Git
展开阅读全文
git
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
在线直播报名
返回顶部
顶部