git 未跟踪的文件 - 如何忽略

标签 git version-control dvcs gitignore git-status

当我运行 git status 时,我看到“未跟踪的文件”部分有很多文件(有些带有“.”扩展名。)

我认为我不需要做任何事情,但是每当我运行 git status 时看到这些文件看起来不太好。有什么办法可以不看到这些文件吗?

最佳答案

“你的”文件,其他人看不到的文件,写在 .git/info/exclude 中。

对于其他人看到的文件,将它们写在项目顶层目录的 .gitignore 中,然后添加并提交 .gitignore 文件。

例如,您的 .gitignore 可能如下所示:

*.o
.*.sw[op]
*~

关于git 未跟踪的文件 - 如何忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6295449/

相关文章:

c++ - 如何有效地将 git 存储库/子模块用于具有许多依赖项的 C++ 产品?

git - 无法在 github 上共享来自 intellij 的项目

version-control - 使用团队基础服务器进行多次结帐

java - 自动构建并将 zip/tar.gz 推送到网站目录

git - 如何在 Visual Studio 2019 中 fork 本地 git 存储库?

git - 将 Git 工作流程转换为 Mercurial

Mercurial 仅提交提示

version-control - 使用 p4 zip 和 unzip 将文件从一台 perforce 服务器导出到另一台

linux - 使用 git pull 在/var/www/vhosts 上的网络服务器上进行部署

git - git commit --amend 是否包含上次提交中的文件?