[英]Hiding files from git— possible without adding to .gitignore?
I have a couple of files I've just added to a directory that's part of a git repo. 我有几个文件刚刚添加到git repo的目录中。 I'd like to hide them from the repo.
我想将它们隐藏在仓库中。
I could add them to .gitignore but is there another way? 我可以将它们添加到.gitignore,但是还有另一种方法吗? These are one-offs and it would be ideal if I could keep the .gitignore from having to list them.
这些是一次性的,如果我可以让.gitignore不必列出它们,那将是理想的选择。
You have many places to specify the ignored files. 您可以在许多地方指定忽略的文件。 See
man gitignore
for details: 有关详细信息,请参见
man gitignore
:
.gitignore
. .gitignore
。 XDG_CONFIG_HOME/git/ignore
or whatever $GIT_DIR/info/exclude
points to, if it exists. XDG_CONFIG_HOME/git/ignore
或$GIT_DIR/info/exclude
指向的任何对象(如果存在)。 core.excludesfile
. core.excludesfile
。 Note that this option can be set globally or in the local copy of the project. But note that, contrary to some other VCS, you can have one .gitignore
on each directory of the project tree. 但是请注意,与其他一些VCS相反,您可以在项目树的每个目录上使用一个
.gitignore
。 Maybe your reticence to use the .gitignore
is because you do not want to use the file in the root directory of your project. 您可能不愿意使用
.gitignore
是因为您不想使用项目根目录中的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.