From: lamikr <lamikr@cc.jyu.fi>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: undoing changes with git-checkout -f
Date: Tue, 10 Jan 2006 00:36:22 +0200 [thread overview]
Message-ID: <43C2E566.2060006@cc.jyu.fi> (raw)
In-Reply-To: <Pine.LNX.4.64.0601091321390.5588@g5.osdl.org>
Linus Torvalds wrote:
>You should realize that git _does_not_know_ about your file. You never
>even told git about it. So git won't ever evenlook at it, much less delete
>it.
>
>So when you do a "git checkout -f", what that does is to rewrite all the
>files that git KNOWS about. Any files git doesn't know about will not ever
>be touched. Your "1.txt" file might as well be an object file, for all git
>knows. And git won't remove your object files or any other files that it
>doesn't know.
>
>(Now, in all fairness, even if you had done "git add", I don't think git
>will remove the file. If you committed the file and then checked out the
>previous version, _then_ it would remove the committed file).
>
>
Now that you say it, I got it, thanks. I expected earlier that git would
perform also the
remove of non-added files as other commands like "git-commit" are anyway
aware
if you have files in your working dir that have not yet added.
>If what you want to do is to clean the git directory of all files that git
>doesn't know about, you can do that with
>
> git-ls-files -z --others | xargs -0 rm --
>
>
Thanks for the tip. I have now added alias git-reset-ff='git-ls-files -z
--others | xargs -0 rm --'
And git-reset-fff (forte fortissimo) would probably blow the whole hd
away :-)
Mika
prev parent reply other threads:[~2006-01-09 22:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-09 21:16 undoing changes with git-checkout -f lamikr
2006-01-09 21:46 ` Junio C Hamano
2006-01-09 22:52 ` lamikr
2006-01-10 4:55 ` Joel Becker
2006-01-10 5:57 ` Junio C Hamano
2006-01-10 6:32 ` Joel Becker
2006-01-10 7:18 ` Joel Becker
2006-01-10 7:42 ` Junio C Hamano
2006-01-10 8:16 ` Joel Becker
2006-01-10 14:51 ` Johannes Schindelin
2006-01-10 16:17 ` Alex Riesen
2006-01-10 16:45 ` Johannes Schindelin
2006-01-10 17:32 ` Alex Riesen
[not found] ` <Pine.LNX.4.64.0601091321390.5588@g5.osdl.org>
2006-01-09 22:36 ` lamikr [this message]
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=43C2E566.2060006@cc.jyu.fi \
--to=lamikr@cc.jyu.fi \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).