Git format-patch usage for easy Query

Source: Internet
Author: User

Summary:

[Junwei @ junwei-fc12 git_test_range] $ git format-patch head ^ <= patch of the latest commit

[Junwei @ junwei-fc12 git_test_range] $ git format-patch head ^ <= patch of the last 2 commit

[Junwei @ junwei-fc12 git_test_range] $ git format-patch head ^ <= patch of the latest 3 commit

[Junwei @ junwei-fc12 git_test_range] $ git format-patch head ^ <= patch of the last 4 commit

[Junwei @ junwei-fc12 git_test_range] $ git format-patch head ^ <= not supported !!!! 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
[Jun Wei @ junwei-fc12 git_test_range] $
[Jun Wei @ junwei-fc12 git_test_range] $
[Jun Wei @ junwei-fc12 git_test_range] $
[Junwei @ junwei-fc12 git_test_range] $ git format-patch head ^ <= patch of the last commit
0001-v1.4.patch
[Jun Wei @ junwei-fc12 git_test_range] $ cat 0001-v1.4.patch
From b0783b0a1fdd994a8e2bbe8678d47783d2e3acb4 mon sep 17 00:00:00 2001
From: junwei & lt; junwei @ junwei-fc12. (none) & gt;
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/
Index b92eaea... 71f3b7f 100644
--- A/
++ B/
@-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

[Jun Wei @ junwei-fc12 git_test_range] $
[Jun Wei @ junwei-fc12 git_test_range] $
[Jun Wei @ junwei-fc12 git_test_range] $ RM 0001-v1.4.patch
[Jun Wei @ junwei-fc12 git_test_range] $
[Junwei @ junwei-fc12 git_test_range] $ git format-patch head ^ '= recent 2 commit patch
0001-v1.3.patch
0002-v1.4.patch
[Jun Wei @ junwei-fc12 git_test_range] $
[Jun Wei @ junwei-fc12 git_test_range] $ cat 0001-v1.3.patch
From 7508329c355c7ea00b9fd25a74ed7d5024cfb4b9 mon sep 17 00:00:00 2001
From: junwei & lt; junwei @ junwei-fc12. (none) & gt;
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/
Index 86ec272 .. b92eaea 100644
--- A/
++ B/
@-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

[Jun Wei @ junwei-fc12 git_test_range] $
[Jun Wei @ junwei-fc12 git_test_range] $
[Jun Wei @ junwei-fc12 git_test_range] $ cat 0002-v1.4.patch
From b0783b0a1fdd994a8e2bbe8678d47783d2e3acb4 mon sep 17 00:00:00 2001
From: junwei & lt; junwei @ junwei-fc12. (none) & gt;
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/
Index b92eaea... 71f3b7f 100644
--- A/
++ B/
@-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

[Jun Wei @ junwei-fc12 git_test_range] $
[Jun Wei @ 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
[Jun Wei @ junwei-fc12 git_test_range] $
[Jun Wei @ 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
[Jun Wei @ junwei-fc12 git_test_range] $

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.