> git init .
Initialized empty Git repository in /home/XXXXX/test/.git/
> ll
total
> touch foo
> git add foo
> git commit -m init
[master (root-commit) cdc99b4] init
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 foo
> echo "bar">foo
> git log
commit cdc99b4fa8cd2117015cd114bf269ab9a209e58c
Date: Thu Jan 28 08:57:34 2016 +0100
init
Change-Id: If5530860db17d2242e4082666042960fc423f737
> git diff --cached cdc99b4fa8cd2117015cd114bf269ab9a209e58c
> cat foo
bar
> git status
# On branch master
# Changes not staged for commit:
# (use "git add ..." to update what will be committed)
# (use "git checkout -- ..." to discard changes in working directory)
#
# modified: foo
#
no changes added to commit (use "git add" and/or "git commit -a")
>
期待的结果是git diff可以输出 bar
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
git diff不加参数就应该看到bar
你正常的git diff不行?