Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Questions on workflow for a team using a git-svn repo

Tags:

git

svn

git-svn

I've bee reading up on git and git-svn. I'm pretty new to git but I've been able to create some basic repos. However, I'm a bit confused on how the workflow would go for git-svn being used by a team. The goal is to convert svn to git for branching and sharing purposes, then commit back to the main svn repo when ready to push to production. Here are my questions:

Should each member of the team create a git repo from the svn repo? Would this approach work when merging back to svn / pulling from each other?

-or-

Should one git repo be created from svn, then that repo is pushed 'publicly' for team members to clone? Then would changes be pulled back to the original git repo for rebasing and pushing to svn?

-or-

Can we do the same as above except just pull changes from each other's working copy repo?

-or-

Am I adding too much complexity to the workflow and should just keep using svn, since it's not an option to just convert entirely to git?

like image 893
Ken Earley Avatar asked Nov 03 '09 18:11

Ken Earley


People also ask

What is difference between SVN and Git repository?

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.

Can you use Git and SVN together?

git-svn is a specialized tool for Git users to interact with Git repositories. It works by providing a Git frontend to an SVN backend. With git-svn, you use Git commands on the local repository, so it's just like using normal Git. However, behind the scenes, the relevant SVN commands are sent to the server.

Which of the following is the best practice while working with Git in a collaborative manner?

Commit early, commit often Git works best, and works in your favor, when you commit your work often. Instead of waiting to make the commit perfect, it is better to work in small chunks and keep committing your work.


4 Answers

I do something along these lines all the time. Here, we've got an svn repository, but several people would rather use git. We just had one person create the git respository, and then we all shared that amongst ourselves (rather than everyone creating his own git-svn copy - the original import took over 30 hours). Now anybody who wants to can just work in git and git svn dcommit to push their changes back to the "real" svn repository.

like image 174
Carl Norum Avatar answered Oct 21 '22 13:10

Carl Norum


Do developers ever have the need of a local repo while not being able to connect to the main repo? (ie: Coding on a plane on a laptop)

If no, then I'd avoid this headache altogether and just use SVN with dev-specific branches.

If however, you'd really like the distributed approach of git, I would go with your third option:

Should one git repo be created from svn, then that repo is pushed 'publicly' for team members to clone? Then would changes be pulled back to the original git repo for rebasing and pushing to svn?

With:

Can we do the same as above except just pull changes from each other's working copy repo?

That should work fine.

like image 43
Ben S Avatar answered Oct 21 '22 12:10

Ben S


Think of each user's git repository as a fancy Subversion client, particularly as one with which it's easy to share revisions without involving the central repository. Then everyone should do what seems best and right to them.

You could also think of the Subversion repository as a fancy git repository.

Should one git repo be created from svn, then that repo is pushed 'publicly' for team members to clone? Then would changes be pulled back to the original git repo for rebasing and pushing to svn?

I don't think that's necessary, because git svn clone works mostly the same as git clone to begin with.

The most important thing to do is to always do git svn rebase before doing git svn dcommit. If you're doing a lot of revision sharing between git repositories, it is probably a good idea to examine the changes you're going to push to Subversion before doing that git svn dcommit.

like image 35
David M Avatar answered Oct 21 '22 14:10

David M


Git-svn easily supports what you want to do. I would recommend that each developer creates their own Git repository from the Subversion repository (git svn clone). Developers can pull from each other if they like, including both commits that have already been pushed up to Subversion and ones that have not.

The git-svn equivalent of svn update is git svn rebase, which effectively does a git rebase operation against the Subversion repository. Any commmits you might have ready to commit, that have already been committed by somebody else, are automatically skipped.

like image 41
Greg Hewgill Avatar answered Oct 21 '22 13:10

Greg Hewgill