Can I use git-svn and look like I was using SVN, if yes how?

試著忘記壹切 提交于 2019-12-22 05:47:14

问题


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.


回答1:


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.



回答2:


It is possible but i think the best is that one changes version control app :)

to get the svn commits to git (after you have already git svn initialized it of course)

git svn fetch

To get your git commits to svn

git commit git svn dcommit



来源:https://stackoverflow.com/questions/5247435/can-i-use-git-svn-and-look-like-i-was-using-svn-if-yes-how

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!