Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply SVN diff to Git?

I have my projects in 2 repositories. One under SVN and one under Git. Whenever I change something in SVN I want to do the same thing to the Git repository.

Say I make a change to SVN repository, producing revision 125. How would I apply these same changes to my Git repository (assuming my Git repository is up to date with revision 124).

Thank you.

like image 230
Andriy Drozdyuk Avatar asked Mar 18 '09 18:03

Andriy Drozdyuk


People also ask

Can you use SVN with Git?

The git-svn tool is an interface between a local Git repository and a remote SVN repository. Git-svn lets developers write code and create commits locally with Git, then push them up to a central SVN repository with svn commit-style behavior.

What is diff between SVN & Git?

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.

Does SVN work with GitHub?

GitHub repositories can be accessed from both Git and Subversion (SVN) clients.


2 Answers

What I actually did/looking for was:

cd /path/to/svn/repo svn diff -r 125 > /tmp/patch.diff cd /path/to/git/repo patch -p0 < /tmp/patch.diff 
like image 86
Andriy Drozdyuk Avatar answered Oct 04 '22 12:10

Andriy Drozdyuk


Try:

svn diff | patch -d /path/to/git/repo -p0 

See svn help diff if you want to export a specific revision's diff.

like image 43
MattJ Avatar answered Oct 04 '22 13:10

MattJ