[Gllug] Mercurial or Subversion for single user?

Richard Jones rich at annexia.org
Wed Mar 24 17:09:30 UTC 2010


On Wed, Mar 24, 2010 at 12:44:08AM +0000, Nix wrote:
> It adds *the actual file*, i.e. the *actual content* to the 'index'
> (also known as the 'cache' or 'staging area', which is a sort of limbo
> files go into before commit. Change the file after 'git add' then do a
> 'git commit', and the thing you added, *without that change*, is what
> gets committed, because what gets added is what's in the index, and the
> index hasn't changed since you did a 'git add'.

Yup, the index is an odd and oddly great concept.  It does take a bit
of getting used to, and is quite unlike any other VCS (AFAIK?)

> (If the changes touch some of the same files, this won't work quite so
> easily, but 'git add -p' lets you add only *chunks* of changed files,
> similar to darcs.)

Don't forget the awesome power of the 's' key (in git add -p mode),
which splits up the hunks to be smaller and smaller.  This means you
can split up even closely related changes.  And (I discovered the
other day) you can even edit the hunks manually before they get added.

What I actually do if I'm randomly hacking on different features, is
to commit it all and frequently (using --amend), then:

  git reset --mixed HEAD^

to completely undo the whole commit, and add/commit it in logical
chunks.

Rebasing / rewriting history has completely changed how I think and
present patches.

Then there's 'git reflog', which means as long as you committed the
change at some point, you're never going to lose it, short of a hard
disk failure.

Rich.

-- 
Richard Jones
Red Hat
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list