All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Josefsson <simon@josefsson.org>
To: Sergey Vlasov <vsu@altlinux.ru>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: gitco - replacement for cvsco
Date: Wed, 28 Feb 2007 15:08:02 +0100	[thread overview]
Message-ID: <87bqje74u5.fsf_-_@latte.josefsson.org> (raw)
In-Reply-To: <20070227174035.f85e8643.vsu@altlinux.ru> (Sergey Vlasov's message of "Tue\, 27 Feb 2007 17\:40\:35 +0300")

Sergey Vlasov <vsu@altlinux.ru> writes:

> 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

  reply	other threads:[~2007-02-28 14:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-27 11:41 Replacement for cvs2cl, for generating ChangeLog Simon Josefsson
2007-02-27 12:23 ` Junio C Hamano
2007-02-27 12:37 ` Johannes Schindelin
2007-02-27 14:40   ` Sergey Vlasov
2007-02-28 14:08     ` Simon Josefsson [this message]
2007-02-28 19:55       ` gitco - replacement for cvsco Yann Dirson
2007-02-28 21:31         ` Simon Josefsson
2007-02-27 15:19   ` Replacement for cvs2cl, for generating ChangeLog Johannes Schindelin
2007-02-28 14:12     ` Simon Josefsson
2007-02-27 19:27   ` Junio C Hamano
2007-02-27 19:45     ` Johannes Schindelin
2007-02-27 20:54       ` Johannes Schindelin
2007-02-27 12:57 ` Andy Parkins
2007-02-27 15:56   ` Johannes Schindelin
2007-02-27 21:27   ` Robin Rosenberg
2007-02-27 21:50     ` Junio C Hamano
2007-02-27 22:22       ` Johannes Schindelin
2007-02-27 22:12     ` Johannes Schindelin
2007-02-28 14:27       ` Simon Josefsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bqje74u5.fsf_-_@latte.josefsson.org \
    --to=simon@josefsson.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=vsu@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.