Git repository unique id

前端 未结 5 695
别跟我提以往
别跟我提以往 2021-01-13 00:44

I need to find out if a commit belongs to a particular git repository.

The idea is to generate some unique id for every repository I need to test. Then I can compa

5条回答
  •  终归单人心
    2021-01-13 01:17

    The SHA1 key is about identifying the content (of a blob, or of a tree), not about a repository.
    If the content differ from repo to repo, then its history has no common ancestor, so I don't think a change-set-based solution will work.

    Maybe (not tested) you could add some marker (without having to change all the SHA1) through git notes.
    See for instance GitHub deploy-notes which uses this mechanism to track deployments.

提交回复
热议问题