git diff命令详解

git diff命令详解

git diff命令存在三种常用的形式,或者说更多。不定期更新

  1. git diff

    git diff命令是将working directory和staging area进行对比。所以基准是staging area.
    - 代表在staging area的基础上少了什么
    +代表在staging area的基础上多了什么

  2. git diff --staged 或者
    git diff --cached

    这两条命令为staging area与last commit比较。基准是last commit.

  3. git diff HEAD

    因为HEAD始终指向当前分支,所以该命令表示working directory与当前分支的last commit做比较。基准是last commit in current branch

你可能感兴趣的:(git diff命令详解)