Re: [PATCH] git-diff: Add --staged as a synonym for --cached.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 3, 2008 at 2:14 AM, Jeff King <peff@xxxxxxxx> wrote:
> 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.

Speaking just for myself, I would find this all a lot less confusing
if "staged" were a refspec of some sort, not an option at all.

   git diff HEAD..STAGED
   git diff STAGED..WORKTREE
   git grep pattern STAGED HEAD sillybranch WORKTREE ^ignorebranch --
path/to/files

git-rev-parse already gives us a nice syntax for including/excluding
particular trees as much as we like; the only problem is you can't
talk about the work tree or index as if they were revisions.

Have fun,

Avery
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux