git log --graph --decorate --pretty=oneline --abbrev-commit --patch --full-history --follow -- "${FileP}"
印刷
* b8800d8 (HEAD -> master, origin/master, origin/HEAD) chore(export): exported to repo
| diff --git a/DotFilesSrc/DotFileTools/Linux/RepositoryTree/Zathura/zathurarc b/DotFilesSrc/DotFileTools/Linux/RepositoryTree/Zathura/zathurarc
| index c15b225..44691e8 100644
| --- a/DotFilesSrc/DotFileTools/Linux/RepositoryTree/Zathura/zathurarc
| +++ b/DotFilesSrc/DotFileTools/Linux/RepositoryTree/Zathura/zathurarc
| @@ -1,2 +1,2 @@
| include Config.txt
| -include SolarizedDark.txt
| +include SolarizedLight.txt
...
* 300d6c6 chore(source): dirty state
| diff --git a/DotFilesSrc/DotFileTools/RepositoryTree/Zathura/zathurarc b/DotFilesSrc/DotFileTools/Linux/RepositoryTree/Zathura/zathurarc
| similarity index 100%
| rename from DotFilesSrc/DotFileTools/RepositoryTree/Zathura/zathurarc
| rename to DotFilesSrc/DotFileTools/Linux/RepositoryTree/Zathura/zathurarc
...
* 1c2327b chore: initial
diff --git a/DotFilesSrc/DotFileTools/RepositoryTree/Zathura/zathurarc b/DotFilesSrc/DotFileTools/RepositoryTree/Zathura/zathurarc
new file mode 100644
index 0000000..c15b225
--- /dev/null
+++ b/DotFilesSrc/DotFileTools/RepositoryTree/Zathura/zathurarc
@@ -0,0 +1,2 @@
+include Config.txt
+include SolarizedDark.txt
它显示所有提交中对文件的更改。
我如何显示上述信息,但仅针对一次提交说使用哈希提交b8800d8
(可以是任何哈希,具体取决于提交)如下
* b8800d8 (HEAD -> master, origin/master, origin/HEAD) chore(export): exported to repo
| diff --git a/DotFilesSrc/DotFileTools/Linux/RepositoryTree/Zathura/zathurarc b/DotFilesSrc/DotFileTools/Linux/RepositoryTree/Zathura/zathurarc
| index c15b225..44691e8 100644
| --- a/DotFilesSrc/DotFileTools/Linux/RepositoryTree/Zathura/zathurarc
| +++ b/DotFilesSrc/DotFileTools/Linux/RepositoryTree/Zathura/zathurarc
| @@ -1,2 +1,2 @@
| include Config.txt
| -include SolarizedDark.txt
| +include SolarizedLight.txt
根据
man git-log
,这可以通过指定要比较的两个提交来完成,用省略号分隔...
您可以使用
HEAD~
符号指定提交,或使用提交哈希。要仅显示最后一次提交的信息,命令是
如果您真的希望能够通过仅提供一个提交哈希来做到这一点,那么下面的 Bash 函数应该可以工作。
声明后,您可以调用它
哪里
b8800d8
是提交散列,FileP
是一个包含文件名的变量。