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

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!



©xgqfrms 2012-2021

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

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


posted @ 2021-10-20 14:51  xgqfrms  阅读(40)  评论(2编辑  收藏  举报