开发者

How to build, in git, old project's history?

开发者 https://www.devze.com 2023-03-21 20:47 出处:网络
I have a project that I want to put onto Git. We have many old \'zip\' snapshots of the project that can be used to create the basis of the putative historical lineage, plus a few even older bits, man

I have a project that I want to put onto Git. We have many old 'zip' snapshots of the project that can be used to create the basis of the putative historical lineage, plus a few even older bits, many I've still to 'find', that I'd still like to add to the history I build.

It isn't too hard to create a lineage from the newer zips [copy, commit, copy, commit, .. etc.] immediately, but how to graft(?) on the older history retrospectively? I'd like the history to look like I entered them chronolo开发者_JAVA百科gically, so some sort of re-write would probably be required.

Because the team is very small and co-located we can easily handle the change over from the draft version to the 'proper' version, so this is a practical exercise in getting started, and finessing the 'still to find' portions once everyone has started using git (I'd rather we were using git that waiting till sufficient 'history as found ;-).

So the question is how do I retrospectively graft on the early history, and then re-write the whole repo so the graft doesn't show? I know this will re-write all the commit SHA1 IDs.


You probably want to do what is described here: https://softwareengineering.stackexchange.com/questions/33868/script-tool-to-import-series-of-snapshots-each-being-a-new-edition-into-git-po

but add the --date option to git commit so that it will set whatever date comes from the zip file.


git rebase -i (interactive rebase) lets you do many useful history modifications. Just note that doing so will mess up any branches anyone made before the rebase, causing everyone to rebase those branches as well.

0

精彩评论

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