git - 使用SourceTree怎么忽略文件?
PHPz
PHPz 2017-05-02 09:26:14
0
6
1571

现在项目是SourceTree和git组合进行版本控制的。
一开始我把需要忽略的文件添加到.gitignore文件里面,但是发现不起作用。然后我在网上搜索了一下,好像说是服务器上面的那些之前提交的要被忽略的文件需要先被删除才能起作用,不然无效。这样就显得比较麻烦了。

我使用了里面的停止跟踪功能,发现也没什么用,不知道怎么才是正确的使用方法。
而里面的忽略方法总是灰色的,无法点击,可能就是因为上面的原因。

请问能不能直接使用SourceTree选择性忽略某些文件?因为有一些无关的本地文件总是会在程序运行后发生变化,一大叠放在那里和杂乱。

PHPz
PHPz

学习是最好的投资!

reply all(6)
淡淡烟草味

Use .gitignore to filter files, such as intermediate files during compilation, etc. These files do not need to be tracked and managed.
Phenomenon:
Add the file1 file in .gitignore to filter the file, but the status of the file1 file is still displayed through git status.
Reason:
This file already exists in the git library, and the file has been submitted by push before.
.gitignore file only works for files that have not been added to version management. If these files have been included in the version library using git before, it will not work.
Solution:
You need to delete the file in the git library and update it.
Then check the status with git status again, and the file1 file no longer displays the status.

Source: http://blog.csdn.net/zhangjs0322/article/details/37658669

左手右手慢动作

Modify .gitignore first, and then push it. You will not see the ignored files or paths next time.
As for only ignoring the files you specify locally...not sure

世界只因有你

Right click on the uncommitted file and see ignore

淡淡烟草味

Recommended to follow WeChat subscription account: Git Assistant

小葫芦

Add .gitignore, edit the file: For example:

#是注释
#Java class files
*.class

# generated files
bin/
gen/
洪涛

Same for my sourceTree, .gitignore doesn't work.
After checking for a while, I came to the conclusion that git has a cache and needs to be cleaned.

You can submit your modifications locally first, and then run the following commands one by one.

git rm -r --cached .
git add .
git commit -m "fixed untracked files"

Reference: http://stackoverflow.com/ques...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template