Reputation:
I recently started using Git when creating a new project - until then I only did regular backups of the projects just by zipping the source of each and everyone. So I now have several DD.MM.YYYY.zip files for each (old) project - by the way each project has only one branch.
Now I want to get rid of all these .zip files and port everything to Git. Here is what I thought of:
Create a new repository.
git init
Copy the files from the oldest .zip file into the repository.
git add ...
git commit ...
Delete the files copied from the oldest .zip file.
Copy the files from the second oldest .zip file into the repository.
git add ...
git commit ...
Delete the files copied from the second oldest .zip file.
...
Is this going to work? Is there any better solution to achive what I want?
Additional:
For some (old) projects I started a Git repository with the newest source and continued programming. For these projects there are still some DD.MM.YYYY.zip files laying around - is there any way to perform a commit to the beginning of a project? (May be a dumb question, but feel free to suggest me something else.)
Upvotes: 3
Views: 242
Reputation: 33203
As mentioned - you can very easily turn zip archives into a git repository.
For merging some new development with another related but non-identical repository you can link the two into one. Possibly rebase is all you need but when I did this I used the following commands and posted a bit more discussion at blog article
git remote add jdc file:///opt/src/tile-qt-jdc
git fetch jdc
git ls-tree 1519481
git read-tree -m 1519481
git checkout-index -f -u -a
read-tree
is an interesting way to set the index to a given tree. There are also 'grafts' but these didn't seem that useful to me.
Upvotes: 1
Reputation: 1324278
It will work if you do, for each new working tree content (with each archive unzipped):
git add -A .
Ie, if you ask Git to add new and modified files, and remove files that don't exist anymore.
For the additional part, you could make an orphan branch, import your zipped history, and then rebase your current branch on top of it.
Upvotes: 2