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]$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值