git diff 未 commit的改动
为情所困
为情所困 2017-05-02 09:27:13
[Git讨论组]
> 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

为情所困
为情所困

全部回复(2)
PHPz

git diff不加参数就应该看到bar

过去多啦不再A梦

你正常的git diff不行?

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号