On Sun, Nov 02, 2008 at 10:30:16AM -0800, Junio C Hamano wrote: > > Looking at --cached/--index we have basically three things: > > > > --cached to refer to the state of the index (diff, grep, [stash], ...) > > --cached to _work on_ the index only (rm, apply, ...) > > --index to _work on_ both the index and the working tree (apply, ...) > > I think the earlier two are the same thing. The only difference between > them is that in the first one, the definition of your "work on" happens to > be a read-only operation. Am I mistaken? I think that is somewhat the case for "grep", for example. But the confusion is that diff is really a different beast, because you are comparing two _different_ locations. So "git diff --staged", while it makes sense to us (since we are asking "what is staged"), is not consistent with the discussed rules. In particular: 1. It operates on just the "stage" and not the working tree, so it should be "--staged-only". But the only there is nonsensical. 2. The default is _already_ operating on the staging area, so you are really switching up the working tree for the HEAD in what you are diffing. So in that sense, it doesn't convey the change in operation very well. And I am not proposing a change here (except to perhaps "git diff --staged" instead of "--cached"). Just pointing out that it does not follow the "--staged operates on both, --staged-only operates on just the index" rule. Hrm. For that matter, grep is a bit different, too. Since I would expect "git grep --staged" to find only staged things, not things in both the working tree and the index. So perhaps there is a difference between commands that modify and commands that inspect. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html