查看指定文件不同提交的差异

查看指定文件不同提交的差异

十月 21, 2019

查看指定文件不同提交的差异

$ git diff temp master #可以查看分支所有文件的差异
diff --git a/commit1 b/commit1
index e885be7..33f9a70 100644
--- a/commit1
+++ b/commit1
@@ -1 +1 @@
-Hello,I'm commit1. -- Modified by temp.
+Hello,I'm commit1.
diff --git a/commit2 b/commit2
index 827e7ef..e69de29 100644
--- a/commit2
+++ b/commit2
@@ -1 +0,0 @@
-Hello, commit2!
diff --git a/temp.log b/temp.log
deleted file mode 100644
index e69de29..0000000
$ git diff temp master -- commit1 #可以过滤指定的文件
diff --git a/commit1 b/commit1
index e885be7..33f9a70 100644
--- a/commit1
+++ b/commit1
@@ -1 +1 @@
-Hello,I'm commit1. -- Modified by temp.
+Hello,I'm commit1.
$ git branch -av
master 9522b28 modify content
* temp 645c351 Modified commit2
$ git diff 645c351 9522b28 -- commit1 #通过查看分支 拿到分支的地址 也可以查询指定文件的差异 效果一样
diff --git a/commit1 b/commit1
index e885be7..33f9a70 100644
--- a/commit1
+++ b/commit1
@@ -1 +1 @@
-Hello,I'm commit1. -- Modified by temp.
+Hello,I'm commit1.