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

gitco - replacement for cvsco

From
Simon Josefsson <simon@josefsson.org>
Date
Feb 28, 2007, 14:08 UTC
Message-ID
<87bqje74u5.fsf_-_@latte.josefsson.org>
In-Reply-To
<20070227174035.f85e8643.vsu@altlinux.ru>
Sergey Vlasov <vsu@altlinux.ru> writes:
Show 23 quoted lines
> On Tue, 27 Feb 2007 13:37:23 +0100 (CET) Johannes Schindelin wrote:
>
>> On Tue, 27 Feb 2007, Simon Josefsson wrote:
>>
>> > Hi!  I'm considering switching to git for my projects (shishi, gsasl,
>> > gnutls, libtasn1, opencdk, ...) and I have some questions:
>> >
>> > * How do I discard all locally modified or added files?  'cvs upd -C'
>> >   does some of that, but I've been using a tool 'cvsco' which quickly
>> >   restore a CVS checkout into a pristine state.
>>
>> The command in git is called "git reset --hard". Beware: this really,
>> really loses _all_ local changes. And no need to worry when it completes
>> much faster than you expected it to... See "git status" to see that it
>> worked, indeed.
>
> But "git reset --hard" won't touch untracked files (this command is
> similar to "cvs update -C", but does not save old contents anywhere).
> If what is really needed is to clean out build products, editor backups
> and other files which are not tracked by git, "git clean -d -x" will do
> it (but this command will keep local changes to tracked files - an
> additional "git reset --hard" is needed to restore them to the last
> committed state).
Thanks!  This script solve my original question:

#!/bin/sh # gitco - cruel checkout. Discards everything that has not been # committed, and checkout missing files. git-clean -d -x git-reset --hard

However, one problem with that, compared to 'cvsco', is that 'git-reset --hard' does not tell me tell me which files were deleted and which file were restored. May I suggest a --verbose or similar?

Here is how to use "gitco":

jas@mocca:~/src/libtasn1$ sha1sum foo Makefile.am gendocs.sh sha1sum: foo: No such file or directory e14704b0c3fe4a07e86e4f66df7c6888f619e7dc Makefile.am ea44aed92044fdafffae08a8ec4191ed357e4321 gendocs.sh

# Ok, so we have two files, one which doesn't exists.

jas@mocca:~/src/libtasn1$ echo hej > foo; echo hej >> Makefile.am ; rm gendocs.sh jas@mocca:~/src/libtasn1$ sha1sum foo Makefile.am gendocs.sh 32a0617aab4c9fe725f1b5bc441291180ad25b73 foo e83aa94eb841a329289395f9a88bd5f89a725535 Makefile.am sha1sum: gendocs.sh: No such file or directory

# Ok, one file deleted, one new created, and one modified.

jas@mocca:~/src/libtasn1$ gitco Removing foo

# It isn't that informative...

jas@mocca:~/src/libtasn1$ sha1sum foo Makefile.am gendocs.sh sha1sum: foo: No such file or directory e14704b0c3fe4a07e86e4f66df7c6888f619e7dc Makefile.am ea44aed92044fdafffae08a8ec4191ed357e4321 gendocs.sh

# Ok, back to where we started.

Regards, Simon

Previous: Sergey VlasovNext: Yann Dirson
Message 5 of 19 in “Replacement for cvs2cl, for generating ChangeLog”
  1. Simon JosefssonFeb 27, 2007
  2. Junio C HamanoFeb 27, 2007
  3. Johannes SchindelinFeb 27, 2007
  4. Sergey VlasovFeb 27, 2007
  5. gitco - replacement for cvscoSimon Josefsson, Feb 28, 2007
  6. Yann DirsonFeb 28, 2007
  7. Simon JosefssonFeb 28, 2007
  8. Johannes SchindelinFeb 27, 2007
  9. Simon JosefssonFeb 28, 2007
  10. Junio C HamanoFeb 27, 2007
  11. Johannes SchindelinFeb 27, 2007
  12. Johannes SchindelinFeb 27, 2007
  13. Andy ParkinsFeb 27, 2007
  14. Johannes SchindelinFeb 27, 2007
  15. Robin RosenbergFeb 27, 2007
  16. Junio C HamanoFeb 27, 2007
  17. Johannes SchindelinFeb 27, 2007
  18. Johannes SchindelinFeb 27, 2007
  19. Simon JosefssonFeb 28, 2007

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.