[英]what's difference between the 'git apply' and 'git fetch'?
when I pull patch from gerrit,a question come:当我从 gerrit pull patch 时,一个问题来了:
what's difference between the 'git apply' and 'git fetch'? “git apply”和“git fetch”有什么区别?
cp patch /the/path/save
git apply patch
and和
git fetch ssh://someone@gerrit.(SOME INFOMATION) && git cherry-pick FETCH_HEAD
Are they the same thing?它们是一样的吗? or do a first and then b或者先做 a 然后做 b
a,b can't be done at the same time.It seems that they do the same thing,but I still cannot understand what difference between them. a,b 不能同时做。看起来他们做的是同一件事,但我仍然无法理解它们之间有什么区别。
Even if fed the same commit contents, the result will differ:即使提供相同的提交内容,结果也会不同:
git cherry-pick
will create a commit that's a copy of the specified commit and retain the original commit information (author, author-date, commit message) git cherry-pick
将创建一个提交,该提交是指定提交的副本并保留原始提交信息(作者、作者日期、提交消息)git apply
will read a diff/patch file and apply it to your current working directory. git apply
将读取差异/补丁文件并将其应用到您当前的工作目录。 However, there's also git am -k
which you can use to import a patch created by git format-patch -k
.但是,还有git am -k
可用于导入由git format-patch -k
创建的补丁。 Then you should end up with a commit that's a copy of a commit, similar to cherry-picking.然后你应该以一个提交的副本结束,类似于 cherry-picking。
https://git-scm.com/docs/git-am https://git-scm.com/docs/git-format-patch https://git-scm.com/docs/git-am https://git-scm.com/docs/git-format-patch
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.