login
Header Space

 
 

Re: [FAQ?] Rationale for git's way to manage the index

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Petr Baudis <pasky@...>, Martin Langhoff <martin.langhoff@...>, <git@...>
Date: Wednesday, May 9, 2007 - 12:29 pm

On Wed, 9 May 2007 08:52:09 -0700 (PDT), Linus Torvalds wrote:
[Snip good description of rebuilding a branch to meet some "target"
state.]

That's all really good stuff. And as you mentioned you sometimes use
cherry-pick during this rebuilding, one can also use "git add -i" to
help with splitting up an ugly commit that should have been multiple
commit.

For example, a sequence might look like this, (I always use "desired"
where you use target):

	git diff HEAD desired | git apply
	git add -i
	git commit
	git reset --hard
	# test here and commit --amend as needed

And repeat that as needed. It's really no different than your "edit
the diff" approach. It's just using "add -i" instead of a text
editor. But I do admit that the commit;reset;test;--amend sequence
might seem a bit too awkward to some people.


This reminds me of a confusing semantic issue that came about with the
"new" add. It can be quite natural to commit a single file in one step
with:

	git commit some-file.c

or to do that in two steps with:

	git add some-file.c
	git commit

(which is particularly useful if one wants to add multiple files).

I recently found myself wanting to do a similar thing with a directory
path. I can commit a path with:

	git commit path/

but I don't get anything at all like the same semantics if I do:

	git add path/
	git commit

(since "git add" will recursively add all untracked files under path/).

Now the "recursively add all files" behavior is older, and has been an
essential part of git-add forever. But I found it to be not at all
what I wanted in this case, (where I'm now trained to say "git add" to
stage things into the index).

I don't know of any good fix for the problem now. Maybe I'll just need to
remember to break out that old "git update-index" for a situation like
this, but that sure feels clunky.

-Carl
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[FAQ?] Rationale for git's way to manage the index, Matthieu Moy, (Sun May 6, 12:10 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Guilhem Bonnefille, (Mon May 7, 7:40 am)
Re: [FAQ?] Rationale for git's way to manage the index, Daniel Barkalow, (Mon May 7, 6:23 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Johannes Schindelin, (Mon May 7, 8:55 am)
Re: [FAQ?] Rationale for git's way to manage the index, Junio C Hamano, (Mon May 7, 3:31 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Linus Torvalds, (Sun May 6, 1:25 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Matthieu Moy, (Sun May 6, 2:23 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Matthieu Moy, (Wed May 9, 1:18 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Martin Langhoff, (Mon May 7, 11:16 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Johannes Schindelin, (Tue May 8, 7:07 am)
Re: [FAQ?] Rationale for git's way to manage the index, Linus Torvalds, (Tue May 8, 12:45 am)
Re: [FAQ?] Rationale for git's way to manage the index, Linus Torvalds, (Wed May 9, 11:52 am)
Re: [FAQ?] Rationale for git's way to manage the index, Junio C Hamano, (Wed May 9, 8:31 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Shawn O. Pearce, (Thu May 10, 6:06 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Petr Baudis, (Thu May 10, 6:51 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Steven Grimm, (Wed May 9, 10:27 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Linus Torvalds, (Wed May 9, 10:39 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Matthieu Moy, (Thu May 10, 4:00 am)
Re: [FAQ?] Rationale for git's way to manage the index, Daniel Barkalow, (Wed May 9, 1:39 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Linus Torvalds, (Wed May 9, 2:16 pm)
Re: [FAQ?] Rationale for git's way to manage the index, J. Bruce Fields, (Wed May 9, 1:18 pm)
Re: [FAQ?] Rationale for git's way to manage the index, J. Bruce Fields, (Wed May 9, 1:29 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Carl Worth, (Wed May 9, 12:29 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Martin Langhoff, (Tue May 8, 1:35 am)
Re: [FAQ?] Rationale for git's way to manage the index, Johannes Schindelin, (Sun May 6, 7:51 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Matthieu Moy, (Mon May 7, 4:02 am)
Re: [FAQ?] Rationale for git's way to manage the index, Johannes Schindelin, (Mon May 7, 7:05 am)
Re: [FAQ?] Rationale for git's way to manage the index, Julian Phillips, (Sun May 6, 6:53 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Shawn O. Pearce, (Mon May 7, 9:41 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Shawn O. Pearce, (Tue May 8, 10:52 am)
Re: [FAQ?] Rationale for git's way to manage the index, Linus Torvalds, (Sun May 6, 3:54 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Johannes Schindelin, (Sun May 6, 12:51 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Matthieu Moy, (Sun May 6, 1:34 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Johannes Schindelin, (Sun May 6, 7:42 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Junio C Hamano, (Sun May 6, 1:43 pm)
Re: [FAQ?] Rationale for git's way to manage the index, Johannes Schindelin, (Wed May 9, 9:57 am)
Re: [PATCH] git-commit: Reformat log messages provided on co..., Johannes Schindelin, (Wed May 9, 11:01 am)
speck-geostationary