git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] make 'git add' a first class user friendly interface to the index

From
Junio C Hamano <junkio@cox.net>
Date
Dec 2, 2006, 07:54 UTC
Message-ID
<7vlklq20n5.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<87veku3i0j.wl%cworth@cworth.org>
Carl Worth <cworth@cworth.org> writes:
Show 7 quoted lines
>> > +Contrary to other SCMs, with GIT you have to explicitly "add" all the
>> > +changed file content you want to commit together to form a changeset
>> > +with the 'add' command before using the 'commit' command.
>
> I think we can explain the git model in positive terms that stand on
> its own. People will learn the differences and appreciate how git is
> better. So I'd just drop "Contrary to other SCMs".

I already committed Nico's on 'master', because all he said in his response made sense, but this comment made me rewind it. I agree that we do not have to start with a "we are harder to learn, we are different from what you know, you have been warned." I'll queue it for 'next'.

> Wow, this index stuff sure takes a lot of explaining. Why are users
> better off having to grasp all of that stuff before they can
> successfully add; edit; #oops, add again; and commit their files?

Jumping the index is not about that sequence. It is about being interrupted while doing something else, and committing a smaller trivial change first that is independent from what you have been doing. Beginners do not have to do that "interrupted work" sequence.

Show 8 quoted lines
>> I wonder if this sequence should do the same as "git rm -f foo":
>>
>> 	$ /bin/rm foo
>>      $ git add foo
>
> Argh. Please no. Update-index already exists. Let's not push all of
> its semantics onto "add". Let's use "add" for when the user _actually_
> wants to _add_ a file. Please? please?

I do agree "adding the deletion" is a funny terminology. But this is a illustration that this part of proposed update to the tutorial could be further improved:

+But for instance it is best to only remember 'git add' + 'git commit' +and/or 'git commit -a'. + +No special command is required when removing a file; just remove it, +then tell `commit` about the file as usual.

We say "you should add modified state again if you edit it again after you added it" in a section before these sentences, and encourage users to consistently say 'git add'. Since we supply "git rm" and "git mv" to make it convenient to remove/rename files and index entries at the same time, I think it would be better to say "Use add/rm/mv", not "don't worry about rm".

By the way, aren't people disturbed that "git rm" does not default to "-f" -- I rarely use the command myself but that makes it feel even more awkward that "git rm foo" does not remove the file "foo".

> PS. Is there a twelve-steps program for people who can't let a thread
> die? I really want to stop, and I keep telling myself I can stop
> anytime I want.
Well, I think at least we are converging.
Previous: Carl WorthNext: Carl Worth
Message 7 of 21 in “make 'git add' a first class user friendly interface to the index”
  1. make 'git add' a first class user friendly interface to the indexNicolas Pitre, Dec 1, 2006
  2. Junio C HamanoDec 1, 2006
  3. Alan ChandlerDec 2, 2006
  4. Nicolas PitreDec 2, 2006
  5. Nicolas PitreDec 2, 2006
  6. Carl WorthDec 2, 2006
  7. Junio C HamanoDec 2, 2006
  8. Carl WorthDec 2, 2006
  9. Jakub NarebskiDec 2, 2006
  10. Han-Wen NienhuysDec 2, 2006
  11. Alan ChandlerDec 2, 2006
  12. Carl WorthDec 2, 2006
  13. Jakub NarebskiDec 2, 2006
  14. Alan ChandlerDec 2, 2006
  15. Nicolas PitreDec 3, 2006
  16. Nicolas PitreDec 3, 2006
  17. Nicolas PitreDec 3, 2006
  18. Jakub NarebskiDec 2, 2006
  19. Nicolas PitreDec 3, 2006
  20. make 'git add' a first class user friendly interface to the indexNicolas Pitre, Dec 3, 2006
  21. Alan ChandlerDec 3, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.