LWN.net Logo

Simplified porcelains?

Simplified porcelains?

Posted Aug 5, 2008 15:10 UTC (Tue) by epa (subscriber, #39769)
In reply to: Simplified porcelains? by alex
Parent article: Git Magic

The thing that worries me from the article is that 'git checkout HEAD' (and perhaps other
commands) lose any uncommitted changes.  With svn, I know that it is always safe to update to
the latest version or to any version, since it will merge the changes with what's in my
working copy.

It's clear that git never permanently loses a commit, unless you run the prune command, but I
would want the revision control system to take just as much care with the contents of my
working directory, even if not committed yet.

What about Easy Git, is that still going?


(Log in to post comments)

Simplified porcelains?

Posted Aug 5, 2008 15:38 UTC (Tue) by nix (subscriber, #2304) [Link]

'git checkout HEAD' fails unless your tree is clean. 'git reset --hard HEAD' will throw your
changes away, but that's fairly difficult to type unless you know what you're doing. ('git
stash' is worth looking at if you're often trying to move around with uncommitted changes in
your tree.)

Simplified porcelains?

Posted Aug 5, 2008 17:19 UTC (Tue) by iabervon (subscriber, #722) [Link]

"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.

Simplified porcelains?

Posted Aug 5, 2008 17:40 UTC (Tue) by newren (subscriber, #5160) [Link]

Yes, EasyGit (eg) is still going. I've used it on a daily basis for nearly the last 6 months, and many others have told me it's helped them in getting started with git.

Just download eg and fire off eg help to get started, or look at the detailed comparison to subversion.

EasyGit basically provides beginner-oriented built-in documentation, checks for and warns about common gotchas with git, and layers things in an orderly fashion. You can switch back and forth between eg and normal git commands too; in fact, there are --translate and --debug options designed to show you what git commands eg is running behind the scenes (in addition to clearly documented differences between eg and git commands, where such differences exist).

I've been a little slow at responding at times, and haven't published some updates and commentary I've been meaning too, but eg is perfectly usable for daily work. I have too many users to abandon it...

Simplified porcelains?

Posted Aug 6, 2008 3:47 UTC (Wed) by benlynn (guest, #53270) [Link]

My bad: in the old days, git was less forgiving. As others have noted, nowadays a checkout
fails on unclean trees. That is, unless you specify particular paths in which case only those
particular paths are overwritten. I've updated the guide to reflect this.

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