git format-patch

总结:

[junwei@junwei-fc12 git_test_range]$ git format-patch HEAD^ <==最近的1次commit的patch

[junwei@junwei-fc12 git_test_range]$ git format-patch HEAD^^ <==最近的2次commit的patch

[junwei@junwei-fc12 git_test_range]$ git format-patch HEAD^^^ <==最近的3次commit的patch

[junwei@junwei-fc12 git_test_range]$ git format-patch HEAD^^^^ <==最近的4次commit的patch

[junwei@junwei-fc12 git_test_range]$ git format-patch HEAD^^^^^ <==不支持!!!!error!!!

 

[junwei@junwei-fc12 git_test_range]$ git log
commit b0783b0a1fdd994a8e2bbe8678d47783d2e3acb4
Author: junwei <junwei@junwei-fc12.(none)>
Date:   Wed Sep 28 17:49:19 2011 +0800

    v1.4

commit 7508329c355c7ea00b9fd25a74ed7d5024cfb4b9
Author: junwei <junwei@junwei-fc12.(none)>
Date:   Wed Sep 28 17:49:10 2011 +0800

    v1.3

commit ae10f81cc52d5eb539a057ad3098b09da0c50b86
Author: junwei <junwei@junwei-fc12.(none)>
Date:   Wed Sep 28 17:48:37 2011 +0800

    v1.2

commit cef313f3ee6ed988388383635b264680d1dc7594
Author: junwei <junwei@junwei-fc12.(none)>
Date:   Wed Sep 28 17:47:17 2011 +0800

    v1.1

commit 85f88806e76ac8a393c901c19bb2d0e544190610
Author: junwei <junwei@junwei-fc12.(none)>
Date:   Wed Sep 28 17:46:59 2011 +0800

    v1.0
[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ git format-patch HEAD^ <==最近的一次commit的patch
0001-v1.4.patch
[junwei@junwei-fc12 git_test_range]$ cat 0001-v1.4.patch 
From b0783b0a1fdd994a8e2bbe8678d47783d2e3acb4 Mon Sep 17 00:00:00 2001
From: junwei <junwei@junwei-fc12.(none)>
Date: Wed, 28 Sep 2011 17:49:19 +0800
Subject: [PATCH] v1.4

---
 a |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/a b/a
index b92eaea..71f3b7f 100644
--- a/a
+++ b/a
@@ -2,3 +2,4 @@ This is the orignal versiom v1.0.
 This is the orignal versiom v1.1.
 This is the orignal versiom v1.2.
 This is the orignal versiom v1.3.
+This is the orignal versiom v1.4
-- 
1.6.5.2

[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ rm 0001-v1.4.patch 
[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ git format-patch HEAD^^《=== 最近的2次commit的patch
0001-v1.3.patch
0002-v1.4.patch
[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ cat 0001-v1.3.patch 
From 7508329c355c7ea00b9fd25a74ed7d5024cfb4b9 Mon Sep 17 00:00:00 2001
From: junwei <junwei@junwei-fc12.(none)>
Date: Wed, 28 Sep 2011 17:49:10 +0800
Subject: [PATCH 1/2] v1.3

---
 a |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/a b/a
index 86ec272..b92eaea 100644
--- a/a
+++ b/a
@@ -1,3 +1,4 @@
 This is the orignal versiom v1.0.
 This is the orignal versiom v1.1.
 This is the orignal versiom v1.2.
+This is the orignal versiom v1.3.
-- 
1.6.5.2

[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ cat 0002-v1.4.patch 
From b0783b0a1fdd994a8e2bbe8678d47783d2e3acb4 Mon Sep 17 00:00:00 2001
From: junwei <junwei@junwei-fc12.(none)>
Date: Wed, 28 Sep 2011 17:49:19 +0800
Subject: [PATCH 2/2] v1.4

---
 a |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/a b/a
index b92eaea..71f3b7f 100644
--- a/a
+++ b/a
@@ -2,3 +2,4 @@ This is the orignal versiom v1.0.
 This is the orignal versiom v1.1.
 This is the orignal versiom v1.2.
 This is the orignal versiom v1.3.
+This is the orignal versiom v1.4
-- 
1.6.5.2

[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ git format-patch HEAD^^^
0001-v1.2.patch
0002-v1.3.patch
0003-v1.4.patch
[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ 
[junwei@junwei-fc12 git_test_range]$ git format-patch HEAD^^^^
0001-v1.1.patch
0002-v1.2.patch
0003-v1.3.patch
0004-v1.4.patch
[junwei@junwei-fc12 git_test_range]$

你可能感兴趣的:(git format-patch)