Thanks. I'm not scripting in this case, Just doing it all "by hand" since I 
only had 5 previous versions to "git-ify". I did the "rm *" in the project 
directory before the "tar x" to be sure that I would detect any deleted 
files. I likely did do a "overkill", but I was more concerned that I missed 
something subtle when I was "converting" my methodology. 

On Wednesday, November 14, 2012 9:37:05 AM UTC-6, Konstantin Khomoutov 
> On Wed, 14 Nov 2012 06:57:33 -0800 (PST) 
> John McKown < <javascript:>> wrote: 
> > I've just recently started learning about git and other version 
> > control systems. What I have done in the past is use "tar" to take a 
> > "checkpoint" of the files in my project subdirectory. So the project 
> > subdirectory is equivalent to the "working directory" in git. And 
> > each tar back is kind of like a commit. Well, I now want to start 
> > using git for this. What I have thought to do is the following for 
> > each tar backup, starting with the oldest and going in time order to 
> > the newest backup. 
> > 
> > 1) take a tar of the current project before I do a "git init" so that 
> > I have a "now" time backup. 
> > 2) rm (delete) all the files in the project subdirectory 
> > 3) do a "git init" in the project subdirectory. 
> > 4) for each tar backup, in order from oldest to newest, do: 
> >     4a) rm (delete) all files in the subdirectory - to remove all 
> > files from previous restore 
> >     4b) "tar xf" to restore the contents to the project subdirectory 
> > for the tar file's "point in time" backup 
> >     4c) do a "git status" and for each file marked as "removed", do a 
> > "git rm" to remove it from the index 
> >           git status | awk '$2 = "deleted:" {print "git rm " $3;}' | 
> > sh 4d) "git add ." to add all the restored contents to the project 
> > subdirectory. Picks up new and modified files. 
> >     4e) "git commit" to commit this time (version) 
> >     4f) "git tag ..." to tag this commit with a label meaningful to me 
> >  5) the project directory is now set up as well as I can. 
> > 
> > I have done this already and it seems to have done what I am 
> > expecting: use git and have a "commit" for each level of my 
> > "snapshot" backups which were in tar files. 
> > 
> > Any thoughts gratefully received. 
> (4a) seems to be redundant as you could just run `tar x --overwrite` 
> at step (4b). 
> Also `git status` is a "porcelain" (user-interfacing) command which is 
> not too suitable for scripting--you might have better results with 
> scripting the "plumbing" `git ls-files` command instead, which, for 
> instance, has the "--deleted" command-line option. 


Reply via email to