简体   繁体   English

SourceTree-使用.gitignore

[英]SourceTree - using .gitignore

I use the SourceTree app to use Git. 我使用SourceTree应用程序来使用Git。 Within my project I installed files using composer. 在我的项目中,我使用composer安装了文件。 Now I have 26.000 files in my working copy, but I now want to start with my changes and with a working copy that shows 0 changes. 现在我的工作副本中有26.000个文件,但现在我要从更改开始,并显示0个更改的工作副本。

I tried it with a .gitignore file in my projects root folder. 我在项目的根文件夹中使用.gitignore文件进行了尝试。 But still - for example I can see files within the media/folder. 但仍然-例如,我可以在媒体/文件夹中看到文件。 Why is this the case and do you have a hint how I can start with a working copy from 0. 为什么会这样,您是否暗示我如何从0开始使用工作副本。

源树

.gitignore

According to the yellow icon on SourceTree, files on media directory are already tracked by git. 根据SourceTree上的黄色图标,git已经跟踪了media目录上的文件。 That's why they are still listed by SourceTree despite the content of .gitignore file. 这就是为什么尽管.gitignore文件的内容仍被SourceTree列出的原因。

So you will have to untrack those files with git rm --cached command. 因此,您将不得不使用git rm --cached命令取消跟踪这些文件。
To do this with SourceTree, right click on the files you want to untrack, and choose Stop tracking . 要对SourceTree执行此操作,请右键单击要取消跟踪的文件,然后选择停止跟踪

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM