开发者

Maintain continuity in Git repo when a file's name changes

开发者 https://www.devze.com 2023-01-18 02:51 出处:网络
I have a codebase of Javascript files that I use to drive a Web site. To synchronize the many files in deployment, I name the files with an appended version number. I have a \"master\" file that conta

I have a codebase of Javascript files that I use to drive a Web site. To synchronize the many files in deployment, I name the files with an appended version number. I have a "master" file that contains current version numbers for the different components. This is used to generate the script tags in the HTML file.

I have the codebase set up as a Git repository. But because of the way I am managing this with version numbers, any time I deploy a new file set, I issue

git mv file.old-vers.js file.new-vers.js

This works in general, except that Git treats this as a complete new file, and so I lose the 开发者_如何转开发history of changes.

Question: is there a way to tell Git to maintain continuity? (i.e. that even though the file name has changed, that it remains the same entity)


git log can track renames. Try git log --follow path/to/file.

0

精彩评论

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