【问题标题】:How to identify delta changes between two commits in git如何识别 git 中两次提交之间的增量更改
【发布时间】:2020-07-14 13:29:49
【问题描述】:

每当我向 gitlab 提交内容时,我都会尝试识别 delta 更改。提交可以大于一。

我正在尝试找到类似于以下问题的答案 Copy differing files between two commits to a specific folder using Git

上述问题中描述的解决方案说它应该只给我增量更改,但我正在获取整个文件。我只需要增量更改。

例如,如果我执行以下命令

git clone <repository location>
git checkout <SHA of old commit>
git diff --name-only <SHA of old commit> <SHA of newer commit> | xargs git checkout-index -f --prefix='C:\changes\'

我在文件夹位置 C:\changes\ 中获取更改的文件。但我只需要更改文件的增量更改,而不是整个文件内容。 不知道我做错了什么。

任何建议都会有帮助。

谢谢。

【问题讨论】:

    标签: git delta


    【解决方案1】:

    在 shell 中,您可以通过 git diff first-commit-sha1..last-commit-sha2 获取 sha1 和 sha2 之间的更改。

    【讨论】:

      猜你喜欢
      • 2020-03-13
      • 2011-02-01
      • 2016-09-29
      • 2020-07-28
      • 2019-12-07
      • 2011-03-09
      • 2017-05-09
      相关资源
      最近更新 更多