git 你如何应用从gerrit下载的补丁文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37758202/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you apply patch file downloaded from gerrit?
提问by Fantastic Mr Fox
In Gerrit, under the download section for a change, there is a section that allows you to download the Patch-File:
在 Gerrit 中,在更改的下载部分下,有一个部分允许您下载补丁文件:
Using git apply
results in:
使用git apply
结果:
$ git apply 441eb56b.diff.base64
fatal: unrecognized input
What command do I use to apply this patch?
我用什么命令来应用这个补丁?
回答by pestophagous
base64 --decode c6a9dcdb.diff.base64 > c6a9dcdb.diff
git apply c6a9dcdb.diff
(Replace c6a9dcdb with whatever abbreviated commit hash Gerrit gave you.)
(用 Gerrit 给你的任何缩写提交哈希替换 c6a9dcdb。)
回答by Marcelo ávila de Oliveira
回答by ElpieKay
Here are possible solutions.
以下是可能的解决方案。
Just copy and paste
Cherry Pick
's command.Just copy and paste
Checkout
's command, and rungit format-patch -1
to create the patch which can be used ingit am
orgit apply
. You could also rungit diff HEAD^..HEAD > xxx.patch
to generate a patch, wchich can be used ingit apply
.Download the diff.zip, unzip it,
git apply
it.Download the diff.base64, decode it,
git apply
it.Run the
git fetch
part inCheckout
orCherry Pick
commands, usegit merge
,git rebase
,git cherry-pick
or any command that can manipulates commits to apply the patch you need.If the patch is to be applied to another branch which can be found in Gerrit, use
cherry-pick
button to do it.
只需复制和粘贴
Cherry Pick
的命令。只需复制并粘贴
Checkout
的命令,然后运行git format-patch -1
即可创建可在git am
或 中使用的补丁git apply
。您也可以运行git diff HEAD^..HEAD > xxx.patch
以生成补丁,可以在git apply
.下载diff.zip,解压,
git apply
就可以了。下载diff.base64,解码它,
git apply
它。运行
git fetch
部分Checkout
或Cherry Pick
命令,使用git merge
,git rebase
,git cherry-pick
或可以操纵提交申请你所需要的补丁的任何命令。如果要将补丁应用到 Gerrit 中可以找到的另一个分支,请使用
cherry-pick
按钮来完成。