如何将git format-patch补丁转换为传统补丁

时间:2015-04-08 19:09:34

标签: git

如何将git format-patch输出转换为传统补丁?

Git format-patch返回如下补丁:

git format-patch -1  1d962ecf1e8d42c09abac2f715239a592c9415de --stdout
From 1d962ecf1e8d42c09abac2f715239a592c9415de Mon Sep 17 00:00:00 2001
From: "brenohl@br.ibm.com" <brenohl@br.ibm.com>
Date: Wed, 18 Jul 2012 09:29:08 +0000
Subject: [PATCH] cxgb3: Set vlan_feature on net_device

cxgb3 interface has a bad performance when VLAN is set. On my current
setup, a PowerLinux 7R2, I am able to get around 7 Gbps on a TCP_STREAM
(8 instances, 4k message).
With this patch, I am able to reach 9.5 Gbps.

Signed-off-by: Breno Leitao <brenohl@br.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
 <PATCH ITSELF>

我知道我可以做一些awk / grep的东西来修复它,但是,我想知道是否有一个工具可以自动为我做这件事。

1 个答案:

答案 0 :(得分:0)

您只需重定向git diff的输出:

git diff <revisions> > /tmp/repo.patch

您可能需要将-p1标记应用于patch

patch -p1 < /tmp/repo.patch