Why does Git use SHA-1 as version numbers?

后端 未结 3 1261
闹比i
闹比i 2020-12-15 15:51

Git uses SHA-1 for the user to refer a commit.

Subversion (SVN) and Mercurial (hg) use an incremental number.

Why did the Git team make that design decision

3条回答
  •  一生所求
    2020-12-15 16:07

    Git and HG both use SHA1 to identify commits. SVN operates a sequential model of change and so is able to support an incremental version number, whereas Git and HG are much more sophisticated and support a directed acyclic graph model of development which is much more amenable to frequent branching and merging.

    The HG incremental number is different from the SVN incremental number and is not suitable for refering to a particular revision across different copies of a repository, so cannot be used in the same way as the SVN revision number.

提交回复
热议问题