如何使用git 生成patch

1,下載代碼

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/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項目的要目錄下。


轉載自 http://blog.csdn.net/liuxd3000/article/details/25798065


發佈了73 篇原創文章 · 獲贊 35 · 訪問量 21萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章