“git diff” does nothing

后端 未结 5 1689
我寻月下人不归
我寻月下人不归 2021-01-30 12:32

I presume this is a configuration error somewhere, but I can\'t figure out where. Regular git commands appear to work fine, but \"git diff\" does nothing. To be safe, I remove

5条回答
  •  囚心锁ツ
    2021-01-30 13:01

    Note: starting git 1.8.5 or 1.9, Q4 2013:

    When the user types "git diff" outside a working tree, thinking he is inside one, the current error message that is a single-liner:

    usage: git diff --no-index  
    

    may not be sufficient to make him realize the mistake.

    Add "Not a git repository" to the error message when we fell into the "--no-index" mode without an explicit command line option to instruct us to do so.


    See:

    • commit 286bc123cd (gitster, Junio C Hamano), which explains that git diff --no-index can act like a regular (non-git) diff.
    • commit b214eddfb2 (Dale R. Worley), which clarifies the error message:

    Clarify documentation for "diff --no-index".
    State that when not inside a repository, --no-index is implied and two arguments are mandatory.

    Clarify error message from diff-no-index to inform user that CWD is not inside a repository and thus two arguments are mandatory.

    To compare two paths outside a working tree:
    usage: git diff --no-index  
    

提交回复
热议问题