Script/tool to import series of snapshots, each being a new edition, into GIT, populating source tree?

Posted by Rob on Programmers See other posts from Programmers or by Rob
Published on 2011-01-05T11:45:24Z Indexed on 2011/01/05 11:58 UTC
Read the original article Hit count: 269

Filed under:
|
|
|

I've developed code locally and taken a fairly regular snapshot whenever I reach a significant point in development, e.g. a working build.

So I have a long-ish list of about 40 folders, each folder being a snapshot e.g. in ascending date YYYYMMDD order, e.g.:-

  1. 20100523
  2. 20100614
  3. 20100721
  4. 20100722
  5. 20100809
  6. 20100901
  7. 20101001
  8. 20101003
  9. 20101104
  10. 20101119
  11. 20101203
  12. 20101218
  13. 20110102

I'm looking for a script to import each of these snapshots into GIT. The end result being that the latest code is the same as the last snapshot, and other editions are accessible and are as numbered.

Some other requirements:

  • that the latest edition is not cumulative of the previous snapshots, i.e., files that appeared in older snapshots but which don't appear in later ones (e.g. due to refactoring etc.) should not appear in the latest edition of the code.
  • meanwhile, there should be continuity between files that do persist between snapshots. I would like GIT to know that there are previous editions of these files and not treat them as brand new files within each edition.

Some background about my aim:

  • I need to formally revision control this work rather than keep local private snapshot copies.
  • I plan to release this work as open source, so version controlling would be highly recommended
  • I am evaluating some of the current popular version control systems (Subversion and GIT) BUT I definitely need a working solution in GIT as well as subversion. I'm not looking to be persuaded to use one particular tool, I need a solution for each tool I am considering. (I haved posted an answer separately for each tool so separate camps of folks who have expertise in GIT and Subversion will be able to give focused answers on one or the other).

The same but separate question for Subversion: Script/tool to import series of snapshots, each being a new revision, into Subversion, populating source tree?

© Programmers or respective owner

Related posts about howto

Related posts about import