Thread (1 message) 1 message, 1 author, 2016-08-11

Re: [PATCH] git-diff: Introduce --index and deprecate --cached.

From: Junio C Hamano <hidden>
Date: 2016-08-11 20:04:12

Andreas Ericsson [off-list ref] writes:
'git diff --cached' still works, but its use is discouraged
in the documentation. 'git diff --index' does the same thing
and is consistent with how 'git apply --index' works.
Although I've applied this long time ago (in git timescale
anyway), this patch and the above rationale is wrong.

'diff --cached' is more in line with how 'apply --cached' works,
not how 'apply --index' works.

With apply, --cached and --index both tell the command to be
aware of the index, but --cached means "operate on the index,
and never look at working tree", while --index means "operate
both on the index and working tree at the same time".  In
particular, the former does not care if the file in the working
tree matches the index, while the latter does.

'diff --cached' is about the tree and the index without looking
at the working tree.  Since there is no mode of operation that
looks at both the index and the working tree in the underlying
diff-index, I made the mistake of applying this patch, but it is
conceivable that we may want to have a 'diff --index' that
compares HEAD, the index and the working tree, perhaps in a
combined diff format.

I think we should revert this patch.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help