我可以使用git-svn,看起来像我使用SVN,如果是的话,怎么样? [英] Can I use git-svn and look like I was using SVN, if yes how?

查看:123
本文介绍了我可以使用git-svn,看起来像我使用SVN,如果是的话,怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我习惯了git,而且我非常喜欢它,但我的一个客户端(仍然是?)使用了subversion,现在我没有真正了解svn,但是我知道有一个git-svn包。 p>

我知道可以用git从svn获取一个repo,但是我可以使用git而不是svn并仍然提交,并推送到中央svn服务器? p>

我想使用git而不是svn,如果我可以的话你可以指点我的任何教程来做到这一点吗?

谢谢你

编辑: 我实际上并不在意抓取所有提交时,只有前10/20才足够,因为应用程序处于工作状态,这只是做了改进,所以如果实际需要,我只会提取所有提交历史记录。

> 从Git和SVN提供了一个桥梁。它会在本地表现得像香草Git,但只要您尝试将变化推送到主控制器或从主控制器上调出,它就会完全不同。



,您将使用 git commit 在本地提交,并且 git svn dcommit 将您的本地提交推送到SVN。



git-svn 文档说明如何从SVN存储库中提取。请注意,它非常缓慢(与普通git相比),因为它会从SVN中获取每个修订版本。请参阅文档底部的示例。



这是我使用它的一种典型方式:


  1. git svn clone http://svn.example.com/project -T trunk -b branches -t tags - 网址是您的SVN repo,并且指定-T,-b和-t开关以在您的SVN目录中指定子路径。然后,Git将使用这些SVN目录来查找分支和标签,并将主干作为主数据库。
  2. 对代码进行一些更改

  3. git add ... 来执行您的更改

  4. git commit ... 本地。

  5. git svn dcommit 将本地提交推送到SVN。对于每个本地提交,Git都会在SVN服务器上进行这些单独的提交。


I'm used to git and I like it very much, but one of my client is (still?) using subversion, I don't really now about svn, but I know there a git-svn package.

I know it's possible to fetch a repo from svn with git, but can i use git instead of svn and still commit, and "push" to the central svn server?

I want to use git and not svn if I can can you point me any tutorial to do so?

Thank you

EDIT:

I actually don't care to fetch ALL the commits, only the 10/20 previous one would be enough as the application is in a working state and that's only about doing improvements so I will only fetch all the commit history if it's actually needed.

解决方案

git-svn provides a bridge from Git and SVN. It will behave like vanilla Git locally, but as soon as you try to push or pull your changes to or from master, it gets completely different.

Instead of doing a push, you will use git commit to commit locally, and git svn dcommit to push your local commits to SVN.

The git-svn documentation explains how to pull from a SVN repository. Note that it is extremely slow (compared to normal git) because it fetches every revision from SVN. See the examples at the bottom of the documentation.

Here it a typical way I've used it:

  1. git svn clone http://svn.example.com/project -T trunk -b branches -t tags - The URL is your SVN repo, and you specify the -T, -b, and -t switches to specify sub paths in your SVN directory. Git will then use these SVN directories to look for branches and tags, and trunk as master.
  2. Make some code changes
  3. git add... to stage your changes
  4. git commit... to commit your changes locally.
  5. git svn dcommit to push the local commits to SVN. For each local commit, Git will make these separate commits on the SVN server.

这篇关于我可以使用git-svn,看起来像我使用SVN,如果是的话,怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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