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.
精彩评论