如何执行“git status”?在未跟踪的目录上?
我的一个子目录中有 6,000 个未跟踪的文件,我正在构建 .gitignore 文件来过滤掉不需要的文件。我正在通过运行“git status”来测试我的 gitignore 过滤器。
但是,我在不同子目录中有大量未跟踪的其他文件,因此“git status”也显示了所有这些文件,这使得很难看出 .gitignore 规则正在做什么。
如果文件被跟踪,那么我可以执行“git status”。它会将 git-status 输出限制为仅当前目录中的那些文件,但由于当前目录及其所有内容都未跟踪,因此“git status”。返回“错误:pathspec。与 git 已知的任何文件不匹配。”
我为此使用 git-1.6.6.1,尽管有趣的是我的测试表明 git-1.7.1(在不同的系统上)实际上允许您在未跟踪的目录上执行 git-status 。不幸的是我无法在这个系统上升级 git。 -1.6.6.1 是否有已知的解决方法?
I have 6,000 untracked files in one subdirectory and I'm constructing .gitignore files to filter out the unwanted ones. I'm testing my gitignore filters as I go by running 'git status'.
However, I have a larger number of untracked other files in a different subdirectory, so 'git status' shows all of those too, which makes it very hard to see what the .gitignore rules are doing.
If the files were tracked, then I could just do 'git status .' and it would restrict the git-status output to only those files in the current directory, but because the current directory and all its contents are untracked, 'git status .' returns "error: pathspec . did not match any file(s) known to git."
I'm using git-1.6.6.1 for this, although interestingly my testing shows that git-1.7.1 (on a different system) does actually let you do git-status on an untracked directory. Unfortunately I can't upgrade git on this system. Is there a known workaround for -1.6.6.1?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试:
You can try:
我会暂时将不需要的(不同的)子目录添加到 .gitignore 文件中,以便忽略其所有内容。然后,准备好后,从
.gitignore
中删除以前不需要的子目录的条目,以便它的文件再次被git status
跟踪。I would temporarily add the unwanted (different) sub-directory to the
.gitignore
file, so that all its contents are ignored. Then, when you're ready, remove the entry for the previously unwanted sub-directory from.gitignore
so that its files become tracked bygit status
once more.