简体   繁体   English

SourceTree .gitignore扩展

[英]SourceTree .gitignore extensions

I'm very new to git/SourceTree. 我是git / SourceTree的新手。 (2) other devs have committed extension files, such as .proj , .cache , etc into the master branch. (2)其他开发人员已将扩展文件(例如.proj.cache等) .cachemaster分支中。 I added a .gitignore file and merged that into the master branch (we have a develop branch as well now). 我添加了一个.gitignore文件,并将其合并到master分支中(现在我们也有一个development分支)。 However, after the merge, I built the project in VS, and I'm still seeing "ignored" files in my "Unstaged files" section in SourceTree. 但是,合并之后,我在VS中构建了项目,但是在SourceTree的“未暂存文件”部分中仍然看到“已忽略”文件。

I read here that I need to "stop tracking" the files. 在这里阅读到我需要“停止跟踪”文件。 When I do this (for the .suo for instance), it pops it up to the "Staged files" and has the red icon next to it. 当我这样做时(例如, .suo ),它会弹出到“暂存文件”中,并在其旁边带有红色图标。 Is this correct, as should I do this for all files? 这是正确的吗,因为我应该对所有文件都这样做吗?

I've also read about git clean . 我也读过有关git clean的内容

Cleans the working tree by recursively removing files that are not under version control, starting from the current directory. 通过从当前目录开始递归删除不受版本控制的文件来清理工作树。

Normally, only files unknown to Git are removed, but if the -x option is specified, ignored files are also removed . 通常,仅删除Git未知的文件, 但是如果指定-x选项,也会删除忽略的文件 This can, for example, be useful to remove all build products. 例如,这对于删除所有构建产品很有用。

Would I run against the master branch in bash? 我会在bash中遇到master分支吗? Otherwise how would I go about cleaning the repository up, removing ignored files. 否则,我将如何清理存储库,删除被忽略的文件。

After creating and committing the .gitignore file, what I did was go into the directories and temporarily move the folders and files that needed to be excluded from git out of the project folder, so that SourceTree would pick up the changes. 创建并提交.gitignore文件后,我要做的是进入目录,并将需要从git中排除的文件夹和文件暂时移出项目文件夹,以便SourceTree接受更改。 Then I stopped tracking on these files/folders and pushed up. 然后我停止跟踪这些文件/文件夹并向上推。

I had same problem. 我有同样的问题。 Make sure you have "Pending" filter selected in Sourcetree. 确保在Sourcetree中选择了“ Pending”过滤器。 If filter is all then it will show all files including ignored. 如果全部为filter,它将显示所有文件,包括被忽略的文件。

SourceTree过滤器

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

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