Subject: Re: getting started, happy with cmd line on windows [Scanned]

From: "Zorba" <[email-masked]>
Date: Sat, 27 Dec 2008 02:18:45 -0000

> Drop "rm *.*".  Instead, probably what you want is
>
>> $ <import code>
>> $ git init
>> $ git commit
>
> which is a good way to make an initial import.
>
>> $ git tag versionA <commitID>
>> $ hack hack hack
>> ...
>
> and you futzed with the codebase without any intention of committing;
> it is nice to be able to experiment freely.
>
> After you are done experimenting,
>
> $ git reset --hard versionA
>
> if you did not make any commit, or even if you did commit while you were
> experimenting, if you do not want these experimental commits at all.
>
> No need for "rm *.*" anywhere.

Hi Junio,

Yes, I had not considered the possibility of being able to reset to last 
commit (as manual page talked about UNDOing commits). $git reset -hard HEAD 
= This is great, and gives me the functionality I want, get back to the last 
conscious commit after hacking.

I've noticed since discovering this that the Reset function on the Win GUI 
will ONLY let you reset as far as but not beyond the last commit (i.e. 
unable to undo any commits) so I can use that too.

The other functionality I was looking for is being able to handle a changing 
"portfolio" of files from version to version:

e.g.
version A = ABC.txt, AB.txt, AC.txt
version B = ABC.txt, AB.txt
version C = ABC.txt, AC.txt
version D = no files

I'm sure this is a common scenario, for ppl starting out with git as they 
load up versions that till now have been sitting in file systems.

By using git-add and git-rm (or git-commit -a) I was able to have my 
add/remove files to the index in "staging" and in the end the versions in 
the repo match up to real life example. Then I can --hard reset back to any 
of these, and ONLY got the files that were in that version.

Its a shame though that git-commit -a only removes files from the index, and 
doesn't add files to the index, otherwise creating new versions is just a 
case of importing the files needed for eacch version and cranking..

$ git commit -a

repeatedly.

But thanks to all who helped me on this one, and who knows maybe this post 
will help some other pilgrim following after me
:-)
Season's geetings,
CR