git and bzr
Linus Torvalds
torvalds at osdl.org
Wed Nov 29 20:45:18 GMT 2006
On Wed, 29 Nov 2006, Marko Macek wrote:
>
> Actually, people (at least me) dislike the index because in the most common
> operations (status, diff, commit), they have to know that the command doesn't
> actually display all their work but just the 'indexed' part of it.
I don't see your point, really.
Nothing forces you to change the index. None of the normal operations do
that, for example, and you really have to _explicitly_ ask git to update
the index for you.
So you can really think of it as a better list of names than what CVS and
others maintain for you. It's exactly the same as the CVS "Entries" file,
except it's got capabilities that CVS will never have - tracking not just
the filename, but the merge status, the permissions, and the actual
contents of an entry.
And by default, and in the absense of any failed merges, you will _never_
see any of those extra capabilities.
> For people used to cvs, svn and other systems it would be nicer if diff -a
> and commit -a (and possibly other commands) were the default.
Why? I mean really.. Why do people mind the index? If you've not done
anything to explicitly update it, and you just write "git commit", it will
tell you exactly which files are dirty, which files are untracked, and
then say "nothing to commit".
Maybe we shouldn't even say "use git-update-index to mark for commit", we
should just say "use 'git commit -a' to mark for commit", but the point
is, there really is no downside. So you forget to mention which files to
commit, what's the downside really? It tells you what is up, and you can
just mention the files explicitly, or use "-a" to say "ok, commit
everything that is dirty", and it doesn't really get any simpler than
that.
And the ADVANTAGES of the index are legion. You may not appreciate them
initially, but the disadvantages people talk about really don't exist in
real life, and once you actually start doing merges with conflicts, and
fix things up one file at a time (and perhaps take a break and do
something else before you come back to the rest of the conflicts), the
index saves your sorry ass, and is a _huge_ advantage.
Similarly, it _allows_ you to do things that just a list of files never
allows you to. You don't _have_ to use it to mark individual files as
being ready to be committed, but you _can_. It's nothing that you need to
know or worry about if you're not aware of the index, but it's a
capability that is there for when you're willing to go there.
So there really isn't any true disadvantage. Most of the people who are
afraid of the index have probably never actually used it, and have never
even had a _reason_ to use it. They're nervous just because they know it
exists, and don't know what it does. But you can just ignore it.
So get over your fears, and just ignore it, and things will be fine.
Linus
More information about the bazaar
mailing list