Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git svn - Can I use git and svn at the same time? no need interaction between git and svn

Tags:

git

svn

I am doing a development project.

The company is using SVN, so for main commit and checkout should be done via SVN.

However, I don't like SVN and am a git user. Since only when I think my code is good I will commit to the company SVN, I would like to use git for my own history keeper.

I don't need to use git to do SVN thing, nor vice versa.

Can I version control my same code using SVN and git at the same time? No interaction between them.

like image 499
Jackson Tale Avatar asked Oct 05 '12 08:10

Jackson Tale


People also ask

What is SVN and Git and in Git why we use branches?

SVN has a Centralized Model. In git every user has their own copy of code on their local like their own branch. In SVN there is central repository has working copy that also make changes and committed in central repository. In git we do not required any Network to perform git operation.

Which feature of Git makes attractive over SVN?

Git has the advantage that it's MUCH better suited if some developers are not always connected to the master repository. Also, it's much faster than SVN. And from what I hear, branching and merging support is a lot better (which is to be expected, as these are the core reasons it was written).

What is the major difference between Git and SVN?

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.


1 Answers

You can clone a subversion repository to your machine using git svn clone <SVN repo URL>. The code will be available as a git repository. You can do your work there and make local commits as you please. There is a command line option to get a "shallow" checkout rather than the entire repository which is often useful. I forget what it is.

Anytime, you want to run the equivalent of svn update, do a git svn rebase. This will fetch new commits which were checked into SVN after you last synchronised and then rebase your changes onto the new tip.

When you're ready with your commits, do a git svn dcommit. This will send all your new commits to svn one by one. You can also squash your local commits into a single one and send it by first doing a local rebase and then an svn dcommit. This should be done on the initial branch (usually master).

The very fact that you're checking out from subversion and then working locally in git means that there is "interaction" between them so your last statement is not valid.

like image 173
Noufal Ibrahim Avatar answered Oct 26 '22 03:10

Noufal Ibrahim