gpt4 book ai didi

git - 探索 git 存储库以查找影响特定区域的更改

转载 作者:太空狗 更新时间:2023-10-29 13:50:52 28 4
gpt4 key购买 nike

我注意到我的 git 存储库中的某些 makefile 缺少变量定义的问题,我想搜索所有提交历史以查找我的变量 TESTDIR 在变更集中出现的位置

我该怎么做?

干杯

最佳答案

你可以使用 git log -p FILENAME 来显示文件的历史,它显示了每个版本之间的差异,你应该能够在那里找到你的更改。

类似的东西:git log --pretty=format:"%h"-p Makefile 给我这样的输出:

$ git log --pretty=format:"%h" -p Makefile
bd45eb7
diff --git a/Makefile b/Makefile
index 58395fa..8bd4e94 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,2 @@
-1
-12
22
32

91f610d
diff --git a/Makefile b/Makefile
index d00491f..58395fa 100644
--- a/Makefile
+++ b/Makefile
@@ -1 +1,4 @@
1
+12
+22
+32

15a8456
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1 @@
+1

如果更改仍在您的 Makefile 中,您可以使用 git blame 找到它所在的修订版。

关于git - 探索 git 存储库以查找影响特定区域的更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5080093/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com