git am和git apply有什么区别? [英] What is the difference between git am and git apply?
本文介绍了git am和git apply有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
git am
和 git apply
来应用修补程序。我看不出有什么不同。我现在看到一个区别: git am
会自动提交,而 git apply
只会触及这些文件,但不会创建提交。这是唯一的区别吗?解决方案
输入和输出都是不同的:
-
git apply
需要一个补丁(例如git diff
)并将其应用于工作目录(或索引,如果- index
或- 使用cached
)。git am
需要一个提交邮箱格式化为电子邮件信息(例如git format-patch
)并将它们应用于当前分支。
/ b>
git am
使用git apply
幕后,但之前做了更多工作(阅读Maildir
或mbox
,并解析电子邮件)和之后(创建提交)。Both
git am
andgit apply
can be used to apply patches. I fail to see the difference. I see a difference now:git am
automatically commits whereasgit apply
only touches the files but doesn't create a commit. Is that the only difference?解决方案Both the input and output are different:
git apply
takes a patch (e.g. the output ofgit diff
) and applies it to the working directory (or index, if--index
or--cached
is used).git am
takes a mailbox of commits formatted as an email messages (e.g. the output ofgit format-patch
) and applies them to the current branch.
git am
usesgit apply
behind the scenes, but does more work before (reading aMaildir
ormbox
, and parsing email messages) and after (creating commits).这篇关于git am和git apply有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文