您的位置:首页 > 其它

如何使用git 生成patch

2015-12-17 17:31 405 查看
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项目的要目录下。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: