Difference between revisions of "Development/Tutorials/Git/git-svn"

Jump to: navigation, search
(added link to bestpractices)
(more intro and outro)
Line 1: Line 1:
Interfacing KDE's SVN repository with git-svn
+
More and more kde developers are using git-svn to contribute to KDE's SVN repository. Git-svn allows you to create a local git repository based on an existing svn repository. This allows you to use some (but not all) of git's useful features. It's very useful if you want to commit code on an airplane. ;)
  
 
<strong>Note:</strong> Please make sure to use Git 1.5.4 or better when you are interfacing with SVN. older versions of git-svn have many issues you might run into otherwise.
 
<strong>Note:</strong> Please make sure to use Git 1.5.4 or better when you are interfacing with SVN. older versions of git-svn have many issues you might run into otherwise.
  
<strong>Note:</strong> git-svn is not able to track most of the svn:properties yet. So, e.g. svn:externals are not fetched.
+
<strong>Note:</strong> git-svn is not able to track most of the svn:properties yet. So, svn:externals are not fetched.
  
 
Here I'm going to explain to you how to fetch [http://edu.kde.org KDE-EDU]-trunk and import it into Git. I will then demonstrate how to make use of Git's features and sync with SVN again.
 
Here I'm going to explain to you how to fetch [http://edu.kde.org KDE-EDU]-trunk and import it into Git. I will then demonstrate how to make use of Git's features and sync with SVN again.
Line 39: Line 39:
  
 
see [[Development/Tutorials/Git/BestPractices]] for guidelines on when to squash.
 
see [[Development/Tutorials/Git/BestPractices]] for guidelines on when to squash.
 +
 +
Now that you've got a git-svn repository set up, you can read about [[Development/Tutorials/Git/Basics|Git Basics]].

Revision as of 01:49, 2 November 2009

More and more kde developers are using git-svn to contribute to KDE's SVN repository. Git-svn allows you to create a local git repository based on an existing svn repository. This allows you to use some (but not all) of git's useful features. It's very useful if you want to commit code on an airplane. ;)

Note: Please make sure to use Git 1.5.4 or better when you are interfacing with SVN. older versions of git-svn have many issues you might run into otherwise.

Note: git-svn is not able to track most of the svn:properties yet. So, svn:externals are not fetched.

Here I'm going to explain to you how to fetch KDE-EDU-trunk and import it into Git. I will then demonstrate how to make use of Git's features and sync with SVN again.

git svn init https://svn.kde.org/home/kde/trunk/KDE/kdeedu
git svn fetch -r798745

For those who don't have a password set up for https access, or who would rather use the more traditional SSH+SVN approach an alternate initialization line for the git repository (replace USERNAME with your username).

git svn init svn+ssh://USERNAME@svn.kde.org/home/kde/trunk/KDE/kdeedu

The revision has to be an existing revision of the module (to be found here).

To later update (sync with SVN) do:

git svn rebase

Now you can do everything you want, for example creating as many local branches as you like and merge back and forth. Whenever you want you can use this command to push your changes back into KDE's SVN repository:

git svn dcommit

Be warned, Git will create one SVN commit for each commit in your Git repository. To create just one commit for the whole merge of a branch into the master branch use the "--squash" feature like this:

git merge --squash mybranch

see Development/Tutorials/Git/BestPractices for guidelines on when to squash.

Now that you've got a git-svn repository set up, you can read about Git Basics.


KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal