开发者

Do files in a GIT repository have some sort of permanent IDs?

I m looking for an开发者_如何学Python ID, associated with a file, that does not change as the file changes or moves over time.


No, Git does not have this. It tracks snapshots of your files as they were at the time of a commit. It doesn't know what happened to the files in between. Some commands like git status are able to infer that two files from different versions with different names but similar content are probably the same file, but it does not actually track the identity of a file through its lifetime.

Now, by using this heuristic you might be able to stitch together the history of a file as long as it never changed too much between two commits. In that case, any commit hash together with the full name of the file in that commit would uniquely identify the file.

I doubt that's what you really want, though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜