LWN.net Logo

Simplified porcelains?

Simplified porcelains?

Posted Aug 5, 2008 17:19 UTC (Tue) by iabervon (subscriber, #722)
In reply to: Simplified porcelains? by epa
Parent article: Git Magic

"git checkout HEAD" doesn't do anything (expect possibly display a bit of useful information).
It's "git checkout HEAD ." (note the filename "." at the end) that will discard uncommitted
changes, because (like in CVS), it's a request to cause the working directory to match "HEAD"
with respect to the path ".".

But I think that section shouldn't really be in that document; it's talking about a
non-recommended method for keeping two computers in sync by confusing one of them and then
intentionally losing the false changes that the computer thinks it has.

Git is actually extremely careful about uncommitted changes. The only ways to lose uncommitted
changes with git are to either ask to discard them (with "checkout <filename>" or "reset") or
ask to have working-directory files modified or removed (e.g., "apply" or "rm"). By default,
git won't even overwrite modified working directory files with merge results like other
version control systems will.


(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds