问题描述
我是 git
的新用户,我正在开始一个新项目。我有一堆我想忽略的点文件。是否存在对 git
的忽略命令,比如 svn
?
没有特别的 git ignore
命令。 编辑位于工作副本适当位置的 .gitignore
文件。然后你应该添加这个 .gitignore
并提交它。注意,只有以 /
开头的文件名才会被忽略。
.gitignore
驻留在其中。其他任何内容都将匹配任何子目录中的文件。 您也可以编辑 .git / info / exclude
忽略该工作副本中的特定文件。 .git / info / exclude
文件将不会被提交,因此仅适用于本地工作副本。
您也可以使用 git config --global core.excludesfile
来设置一个模式为全局的文件。这将在本地适用于同一用户帐户上的所有git工作副本。
运行 git help gitignore
并阅读文本的细节。
I am a new user to git
and I am starting a new project. I have a bunch of dot files that I would like to ignore. Is there an ignore command for git
like there is for svn
?
There is no special git ignore
command.
Edit a .gitignore
file located in the appropriate place within the working copy. You should then add this .gitignore
and commit it. Everyone who clones that repo will than have those files ignored.
Note that only file names starting with /
will be relative to the directory .gitignore
resides in. Everything else will match files in whatever subdirectory.
You can also edit .git/info/exclude
to ignore specific files just in that one working copy. The .git/info/exclude
file will not be committed, and will thus only apply locally in this one working copy.
You can also set up a global file with patterns to ignore with git config --global core.excludesfile
. This will locally apply to all git working copies on the same user's account.
Run git help gitignore
and read the text for the details.
这篇关于是否有像svn一样的git忽略命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!