< Development‎ | Tutorials
Revision as of 02:40, 2 November 2009 by Chani (Talk | contribs) (git-stash instructions moved)

Jump to: navigation, search

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
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://

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 start hacking. :) 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.

Note: git-svn cannot sync with SVN when you have local, uncommited changes. If this becomes inconvenient you should use git stash.

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