如何使用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

如何使用git 生成patch

时间: 2024-08-03 07:53:20

如何使用git 生成patch的相关文章

如何使用git 生成patch 和打入patch 标签: gitpatch【转】

本文转载自:http://blog.csdn.net/liuhaomatou/article/details/54410361 平时我们在使用git 管理项目的时候,会遇到这样一种情况,那就是客户使用git 生成patch 给到我们,那我们就需要把客户给到patch 打入到我们的project ,基于这样一个场景,我把git 如何生成patch 和如何打入patch 做总结   生成patch 的方法:(我这里描述的生成patch 是根据commit 记录生成的) 1.例如首先先通过git lo

如何使用git 生成patch 和打入patch【转】

本文转载自:http://blog.csdn.net/liuhaomatou/article/details/54410361 平时我们在使用git 管理项目的时候,会遇到这样一种情况,那就是客户使用git 生成patch 给到我们,那我们就需要把客户给到patch 打入到我们的project ,基于这样一个场景,我把git 如何生成patch 和如何打入patch 做总结   生成patch 的方法:(我这里描述的生成patch 是根据commit 记录生成的) 1.例如首先先通过git lo

git 生成patch和应用patch【转】

本文转载自:http://www.jianshu.com/p/814fb6606734 1.在git源码目录下执行 1.1.两个commit间的修改(包含两个commit) git format-patch <r1>..<r2>如:git format-patch d77aaac74845435744c49ae65511d9e1be79ed5c...046ee8f8423302f5070ca81b4e246516e919cd7a -o patch 1.2.单个commit git

Git基础-生成Patch和使用Patch

1.生成Patch(俗称快照) 先来看看repo manifest 的用法 <1>cd /工作目录/项目目录/.repo/manifests <2>repo manifest -r -o 20170601_LittleCola.xml <3>将快照(.xml文件)push到服务器 a. git status b. git add . c. git commit -m "modify message" d. git push ..... 2.使用Pat

使用 Git 生成标准 Patch

源地址:http://stackvoid.com/how-to-use-git-generate-patch/ 发布给别的厂商的代码,随着 Bug 的解决,需要即使通知厂商,这时候 Patch 就大显身手了. 今天跟大家分享总结如何快速生成一个标准的Git可以识别的Patch. 1.初始化git环境 使用 git init git add * //添加所有文件到本地 git commit -m "init" //提交所有文件到本地 命令来初始化当前的git目录.如果当前目录有 .git

Git的Patch功能

Git的Patch功能 UNIX世界的软件开发大多都是协作式的,因此,Patch(补丁)是一个相当重要的东西,因为几乎所有的大型UNIX项目的普通贡献者,都是通过 Patch来提交代码的.作为最重要的开源项目之一,Linux,也是这样的.普通开发者从软件仓库clone下代码,然后写入代码,做一个Patch, 最后用E-mail发给Linux Kernel的维护者就好了.Git最初作为Linux的版本控制工具,提供了透明.完整.稳定的Patch功能. 我们先介绍一下Patch是什么.如果一个软件有

git diff patch

如何生成patch:修改一个地方,然后git diff > xxx.patch 就会生成一个patch文件,这里的关键似乎是, 源文件的某个模块的版本要和线上发布的最新版本要一致,这样patch才会被官方采纳. git diff --help就会激活一个帮助页面git xxx --help 如何采用patch下载patch文件到当前文件夹,保持环境文件和线上一致,然后git apply -v xxx.patchrm -rf xxx.patch touch .gitignorevi .gitign

步骤:用git提交patch,并发送邮件列表

一. 先配置git send-mail 的 smtp服务器:1. 安装git-email:# apt-get install git git-core git-email 修改gitconfig文件:vim ~/.gitconfig [color] ui = auto [commit] template = -/.commit_template [user] name = *** email = ***@***.com [alias] pretty = log --branches --remo

Linux下生成patch和打patch

转自:http://blog.csdn.net/dl0914791011/article/details/17299103 通过diff工具生成补丁, patch工具打上补丁. 在使用diff之前, 你需要保留一份未修改过的源码, 然后在其它地方修改源码的一份拷贝. diff对比这两份源码生成patch. 修改过的源码必须保留原来的文件名, 例如, 如果你修改源码中的a.c文件, 那么, 修改后的文件还是名为a.c, 在修改之前你可以复制a.c为a.orig.c进行备份. 1.为单个文件生成补丁