使用git时,如果想把一个项目的修改添加到另一个项目中时,可以使用git format-patch命令,把补丁包放到一个目录下面,在项目中使用git am命令即可。在使用git am时有时会报patch does not apply

When you have resolved this problem run "git am --resolved".

If you would prefer to skip this patch, instead run "git am --skip".

To restore the original branch and stop patching run "git am --abort".

这些错误,说明当前patch有冲突,不能合并,此时使用git apply --reject patch文件,强制把不冲突的文件先合并,有冲突的会生成.rej文件 ,在根据这个文件中的修改去手动执行即可 ,解决完冲突要把.rej文件删除,在执行git add . ==>  git am --continue命令即可。

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐