Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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.

like image 623
ÉricP Avatar asked Mar 09 '11 14:03

ÉricP


People also ask

Can I use Git and SVN at the same time?

No interaction between them. Just ignore the . git folder for SVN and the . svn folder for Git and you should be fine.

Is Git and SVN same?

The difference between Git and SVN version control systems is that Git is a distributed version control system, whereas SVN is a centralized version control system. Git uses multiple repositories including a centralized repository and server, as well as some local repositories.

Should I use SVN or Git?

SVN is better than Git for architecture performance, binary files, and usability. And it may be better for access control and auditability, based on your needs.


1 Answers

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.
like image 83
vcsjones Avatar answered Sep 30 '22 04:09

vcsjones