git - "git add"和 "git update-index"有什么区别

标签 git

“git add”和“git update-index”有什么区别?

在什么情况下我会使用这些命令中的一个或另一个?

最佳答案

基本上,update-index是一个plumbing 命令——意思是,低级别。 git add内部使用 update-index .我相信,那

git add <file>git update-index --add <file>相同

其中一种情况,当我使用 update-index 时,您对文件进行了更改,但您不想提交 - 在这种情况下,您可以运行

git update-index --assume-unchanged <file>

所以如果你运行 git status之后,您会看到该文件不在已更改文件列表中。

更多信息 How to manage configuration files when collaborating?

这里http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html

关于git - "git add"和 "git update-index"有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38585812/

相关文章:

c# - 解码 git 对象/"Block length does not match with its complement"错误

git - 将更改从 git 子树推送到分支以进行 pull 请求

git - 使用 git 存储库和 jenkins 执行子项目的 Maven 发布

git - 如何阻止 root 运行 git pull?

git - 如何使用 Bitnami Gitorious 堆栈通过 HTTP 克隆 git 存储库?

git - 压缩推送的 Git 提交的最佳实践是什么

git - 未跟踪的 git 子模块

gitosis 更改服务器

git repo 提供了来自 WSL 的矛盾信息而不是标准 Windows

git - 在网站上使用 Git