git format-patch 生成指定commit的补丁

官方解释:
The first rule takes precedence in the case of a single . To apply the second rule, i.e., format everything since the beginning of history up until , use the --root option: git format-patch --root . If you want to format only itself, you can do this with git format-patch -1 commit .

git format常用命令:
git format-patch -3 //从当前分支最新提交点往下共生成3个补丁
git format-patch -1 指定commit号 //生成指定commit号的补丁
eg:git format-patch -1 5f123e379cc97c317d6094bcfa2281e1189d61f3
生成5f123e379cc97c317d6094bcfa2281e1189d61f3号的补丁,该commit号不一定在该分支开头,可以在该分支的任意位置。

你可能感兴趣的:(linux,git,指定commit,补丁)