开发者

How do I do automatic tracking of filename changes with GIT?

开发者 https://www.devze.com 2023-02-22 13:34 出处:网络
I\'ve heard tha开发者_运维百科t with GIT, you can make it automatically track filename changes (i.e. if you change a filename, it automatically notices that the checksum is very similar, and updates t

I've heard tha开发者_运维百科t with GIT, you can make it automatically track filename changes (i.e. if you change a filename, it automatically notices that the checksum is very similar, and updates the filename in the repository automatically).

Does anyone have an example of how this is done?


This is not checksum-based but rather on the delta of the file versions (unless the checksums are absolutely identical, i.e. a rename without additional changes in the file).

The used SHA-1 (a hash actually, not only a checksum) was designed for security and therefore does not expose any hints to similarity as far as research goes.

That said, you might also look into git's source code to be sure how it works. Maybe start with the piece of front-end code that shows that a rename has taken place, and work your way backwards to the locations where the detection is done.


Usually git is able to find the old and new filename itself. In doubt, let git move the file

git mv <source> <destination>


I ended up using SmartGIT. Its a very cool GIT interface: if any files in your source code tree are updated/moved/renamed, it lets you know, so you can always be sure that GIT has all the source code you need to compile your project.

0

精彩评论

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