git 如何检查是否需要合并?
根据 文档,git update-index --refresh
这样做:
查看当前索引并通过检查 stat() 信息来检查是否需要合并或更新。
git“检查是否需要合并或更新”是什么意思?git 是否在某些操作后在某处保留一个任意标记,表示“mergeme”?
另外,我想我了解 stat
(什么是 git 索引中的“统计信息”吗?),但我不知道如何了解 UID 帮助 git 知道是否需要进行合并。
According to documentation, git update-index --refresh
does this:
Looks at the current index and checks to see if merges or updates are needed by checking stat() information.
What does it mean that git "checks to see if merges or updates are needed"? Does git keep an arbitrary flag somewhere saying "mergeme" after certain operations?
Also, I think I understand stat
( what is "stat information" in a git index? ), but I don't see how knowing things like the UID help git at all know if a merge needs to happen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该描述有点误导。此命令检查工作副本是否偏离索引。在这种情况下,合并意味着您需要使用 git add 、 git rm 或 git checkout 来引入索引和工作同步复制。这与 git merge 无关。
索引存储工作副本文件
stat
信息的快照,以优化用户修改的检测。每次将这些修改插入暂存区域时(git add
、git rm
)或工作副本修改被丢弃时(git checkout
),它都会更新代码>,<代码>git重置,...)。The description is a little misleading. This command check if the working copy has diverged from the index. In this context, a merge means that you'll need to use
git add
,git rm
orgit checkout
to bring the index and the working copy in sync. This has nothing to do withgit merge
.The index store a snapshot of the working copy file
stat
information in order to optimize the detection of modification by the user. It is updated every time those modification are inserted into the staging area (git add
,git rm
) or when the working copy modification are discarded (git checkout
,git reset
, ...).