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

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

问题描述

有没有办法让git format-patch创建的补丁与svn兼容,以便我可以将它提交到svn repo?



我是在github上工作了一个svn repo,并想将我的修改提交回主存储库。我需要创建一个补丁来做到这一点,但补丁不能应用,因为git格式的补丁不同于svn。我还没有发现一些秘密吗?



更新:虽然目前没有脚本或原生git方式来执行此操作,但我确实设法从今年早些时候找到一篇文章,介绍如何手动完成这一任务。我遵循指示,并成功地让我的git补丁与svn一起工作。



如果有人可以在编写脚本来实现这一点并为git做贡献项目,我是每个人都将非常感激。

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

解决方案

我总是需要Google,但我发现完美的方式(对我而言)是:


  • 使用创建补丁git diff --no-prefix master..branch> somefile.diff ,master和branch部分是可选的,取决于你想如何得到你的差异。
  • 在任何地方发送并使用 patch -p0 < somefile.diff



它似乎对我来说工作得很好,似乎是我遇到的最简单的方法。

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?

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?

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.

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:

  • 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天全站免登陆