xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

git diff one of committed file All In One

git diff one of committed file All In One

git-diff - Show changes between commits, commit and working tree, etc

$ git --help

$ git help diff

# quit === Command + C
Unknown locale, assuming C

git diff [<options>] [<commit>] [--] [<path>…​]
git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>…​]
git diff [<options>] [--merge-base] <commit> [<commit>…​] <commit> [--] [<path>…​]
git diff [<options>] <commit>…​<commit> [--] [<path>…​]
git diff [<options>] <blob> <blob>
git diff [<options>] --no-index [--] <path> <path>

https://git-scm.com/docs/git-diff

$ git diff


# one commits back & now
$ git diff HEAD^ HEAD package.json

# two commits back & now
$ git diff HEAD^^ HEAD package.json

# git diff <revision_1>:<file_1> <revision_2>:<file_2>

demos

$ gst
On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        deleted:    react-version/yarn.lock
        deleted:    vue-versioon/yarn.lock

$ git diff HEAD^ HEAD -- ./vue-versioon/yarn.lock

refs

https://stackoverflow.com/questions/3338126/how-do-i-diff-the-same-file-between-two-different-commits-on-the-same-branch

https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-diff.html



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @   xgqfrms  阅读(44)  评论(2编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2020-10-20 如何使用 js 写一个正常人看不懂的无聊代码
2020-10-20 如何用 js 实现一个 ES6 class 类函数 All In One
2020-10-20 如何使用 js 实现一个 throttle 函数 All In One
2020-10-20 如何使用 js 实现一个 debounce 函数 All In One
2020-10-20 what's the difference amount of pdf, epub, and mobi format
2020-10-20 ADN vs CDN All In One
2020-10-20 How to enable HTTPS for local development in macOS by using Chrome All In One
点击右上角即可分享
微信分享提示