Git 格式补丁要与 svn 兼容? [英] Git format-patch to be svn compatible?

查看:19
本文介绍了Git 格式补丁要与 svn 兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以让用 git format-patch 创建的补丁与 svn 兼容,以便我可以将其提交给 svn 存储库?

Is there any way to get a patch created with git format-patch to be svn compatible so that I can submit it to an svn repo?

我正在 github 上处理一个 svn 存储库,并希望将我的更改提交回主存储库.我需要创建一个补丁来执行此操作,但是无法应用该补丁,因为 git 格式的补丁与 svn 不同.是不是有什么我还没发现的秘密?

I'm working off an svn repo on github and want to submit my changes back to the main repo. I need to create a patch to do this, however the patch cannot be applied since git formats that patch differently then svn. Is there some secret I haven't discovered yet?

更新:虽然目前没有脚本或本地 git 方法可以做到这一点,但我确实设法从今年早些时候找到了一篇关于如何手动完成此操作的帖子.我已经按照说明操作并成功地让我的 git 补丁与 svn 一起工作.

UPDATE: Although currently there exists no script or native git way to do this, I did managed to find a post from earlier this year about how to manually accomplish this. I have followed the instructions and had success getting my git patches to work with svn.

如果有人能够尝试编写脚本来完成此任务并为 git 项目做出贡献,我将不胜感激.

If someone could take a stab at writing a script to accomplish this and contribute to the git project, I'm everyone would be much appreciated.

http://kerneltrap.org/mailarchive/git/2008/1/15/570308/thread#mid-570308

推荐答案

我总是不得不在谷歌上搜索这个,但我发现(对我来说)完美的方式是:

I always have to Google this but the way I've found that works perfectly (for me) is:

  • 使用 git diff --no-prefix master..branch > 创建补丁somefile.diff,master 和 branch 部分是可选的,取决于你想如何获得你的差异.
  • 将它发送到任何地方并使用 patch -p0 <;somefile.diff.
  • Create the patch with git diff --no-prefix master..branch > somefile.diff, the master and branch part are optional, depends how you want to get your diffs.
  • Send it wherever and apply with patch -p0 < somefile.diff.

它对我来说似乎总是很好,而且似乎是我遇到的最简单的方法.

It always seems to work fine for me and seems to be the simplest method that I've come across.

这篇关于Git 格式补丁要与 svn 兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆