我是 Git 新手。
据我所知,提交 ID 用于识别单个更改。
标记/标记用于识别存储库在特定时间点的整个状态。
但是,在学习“引用提交”,更具体地说是“树式”时,我遇到了以下输入:
In Git, tree-ish means something that references part of the tree.
Now in its simplest terms, a tree-ish is a reference to a commit because that commit then in turn references the tree, the Git repository and all the files that are in there at that point.
那么如果两者都持有存储库的当前状态:两者之间有什么区别?
最佳答案
标签与commit非常相似。
您可以将标签视为人类可读的提交。
标记是提交它的指针,但不是记住 SHA-1 的 40 个字节,而是使用字符串 ex v1.0 等引用它。它只是将人类可读的字符串附加到 SHA-1。
标签实际上存储它指向的提交 ID,您可以通过更改提交 ID 将标签移动到不同的提交。
使用标签的推荐方法是使用 -a 标志。
git tag -a
将创建带注释的标签。带注释的标签将为标签创建类似条目的提交(日期、提交者、消息等)。
关于git - Commit ID 和 Tag ID 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30214676/