git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
ZZorba <cr@altmore.co.uk>
Date
Dec 27, 2008, 02:00 UTC
Message-ID
<gj43am$fu6$3@ger.gmane.org>
In-Reply-To
<7v4p0qlcnc.fsf@gitster.siamese.dyndns.org>
Show 23 quoted lines
> 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

Previous: Junio C HamanoNext: Daniel Barkalow
Message 5 of 7 in “getting started, happy with cmd line on windows [Scanned]”
  1. Conor RaffertyDec 26, 2008
  2. René ScharfeDec 26, 2008
  3. ZorbaDec 26, 2008
  4. Junio C HamanoDec 26, 2008
  5. ZorbaDec 27, 2008
  6. Daniel BarkalowDec 28, 2008
  7. ZorbaDec 30, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.