Ignoring directories in Git repos on Windows
如何在Windows上使用msysgit忽略Git中的目录或文件夹?
Create a file named .gitignore
in your project's directory. Ignore directories by entering the directory name into the file (with a slash appended):
dir_to_ignore/
More info here.
By default windows explorer will display .gitignore
when in-fact the file name is .gitignore.txt
Git will not use .gitignore.txt
And you can't rename the file to .gitignore
because explorer thinks its a file of type gitignore with no name.
Non command line solution:
You can rename a file to ".gitignore." and it will create ".gitignore"
It seems that for ignoring files and directories there are two main ways:
.gitignore
.gitignore
file into the root of your repo besides .git
folder (in Windows make sure you see the true file extension and then make .gitignore.
(with the point at the end to make empty file extension) ) ~/.gitignore_global
and running git config --global core.excludesfile ~/.gitignore_global
to add this to your git config note: files tracked before can be untracked by running git rm --cached filename
Repo exclude - For local files that do not need to be shared, you just add the file pattern or directory to the file .git/info/exclude
. Theses rules are not commited, so are not seen by other users more info here
[updated] To make exceptions in list of ignored files, see this question.
链接地址: http://www.djcxy.com/p/30288.html上一篇: 两个应用程序可以听同一个端口吗?
下一篇: 在Windows上忽略Git仓库中的目录