Now the project is version controlled by a combination of SourceTree and git.
At first I added the files that needed to be ignored to the .gitignore file, but found that it didn’t work. Then I searched on the Internet, and it seemed that the previously submitted files on the server to be ignored need to be deleted before they can work, otherwise they will be invalid. This seems more troublesome.
I used the stop tracking function, but found it useless. I don’t know how to use it correctly.
The ignore method inside is always gray and cannot be clicked, probably because of the above reasons.
Can I directly use SourceTree to selectively ignore certain files? Because there are some irrelevant local files that will always change after the program is run, a large pile is there and cluttered.
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: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...