如何使用git 生成patch

2021-06-22 01:22:40 字數 1113 閱讀 5225

git clone git:

cd bluetooth-next-2.6

2,修改**

vi drivers/bluetooth/btusb.c

3,把**新增到git管理倉庫

git add drivers/bluetooth/btusb.c

4,提交修改

git commit -m "added atheros3012 chip firmware download support"

5,檢視日誌

git log <== to git the previous commit hash code.

6,生成patch

git format-patch -s 1bbe3c8c197a35f79bfddaba099270a2e54ea9c7

please replace the hash code with your repo previous commit.

then you can find the patch under repo directory.

then mail your patch to configuration admin. 

或者使用

git format-patch head^ <==最近的1次commit的patch

git format-patch head^^ <==最近的2次commit的patch

git format-patch head^ <==最近的3次commit的patch

git format-patch head^ <==最近的4次commit的patch

git format-patch head^^^^^ <==不支援!!!!error!!!

7,退回去

git reset --hard 1bbe3c8c197a35f79bfddaba099270a2e54ea9c7

8.將補丁打上去。

patch -p1 < 0001-added-liuxingde-test.patch

注: 0001-added-liuxingde-test.patch為想要打的補丁的名字。執行該命令需在git專案的要目錄下。

如何使用git 發patch

多發patch,多產生一些好的 idea,才可以在open software community中越混越好。首先配置git。這裡有兩種配置檔案,乙個是全域性的,在使用者的home目錄下,乙個是相應git倉庫的。如果你設定了全域性的,那麼可以用在各個git倉庫上。檢視一下我已經配置好的配置檔案 hac...

git 生成patch 方法

用git生成patch檔案然後用email的方式提交 git clone git git.kernel.org pub scm linux kernel git padovan bluetooth next 2.6.git cd bluetooth next 2.6 2,修改 vi drivers ...

git 生成patch 方法

用git生成patch檔案然後用email的方式提交 git clone git cd bluetooth next 2.6 2,修改 vi drivers bluetooth btusb.c 3,把 新增到git管理倉庫 git add drivers bluetooth btusb.c 4,提交...