Difference between revisions of "Git-svn"
(fix typo in script) |
|||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
How to use git with the paparazzi subversion repository. See the [http://git.or.cz/course/svn.html Git - SVN crash course] for an introduction into git for svn users or have a look the pretty comprehensive [http://utsl.gen.nz/talks/git-svn/intro.html git-svn intro] for how to use git together with svn | How to use [http://git-scm.com/ git] with the paparazzi subversion repository. See the [http://git.or.cz/course/svn.html Git - SVN crash course] for an introduction into git for svn users or have a look the pretty comprehensive [http://utsl.gen.nz/talks/git-svn/intro.html git-svn intro] for how to use git together with svn. | ||
To get an understanding off the git internals the [http://blip.tv/file/4094854 video Getting Git] is excellent. | |||
== Get the code == | == Get the code == | ||
First clone the master repo from github as described [[Git|here]]. | |||
If you list the remote branches with '''git branch -r''', you can see that you now have the subversion branches under github/svn/*. | |||
If you list the remote branches with '''git branch -r''', you can see that you now have the subversion branches under | |||
To update from this github mirror just run | To update from this github mirror just run | ||
git fetch | git fetch | ||
Line 13: | Line 13: | ||
git config svn.authorsfile .git/svnauthorsfile | git config svn.authorsfile .git/svnauthorsfile | ||
Since you only have the commits but not the SVN metadata you need to rebuild it. First make the all refs look just like they would look from a fresh import using git update-ref. | Since you only have the commits but not the SVN metadata you need to rebuild it. First make the all refs look just like they would look from a fresh import using git update-ref. | ||
To do this for all branches listed under | To do this for all branches listed under github/svn/ you can run this small script: | ||
git for-each-ref refs/remotes/ | git for-each-ref refs/remotes/github/svn/ | cut -d / -f 5- | | ||
while read ref | while read ref | ||
do | do | ||
git update-ref refs/remotes/svn/"$ref" | git update-ref refs/remotes/svn/"$ref" github/svn/"$ref" | ||
done | done | ||
Tell git where to find the SVN repository and rebuild the index: | Tell git where to find the SVN repository and rebuild the index: | ||
Line 27: | Line 27: | ||
git pull | git pull | ||
or to get all the changes (including the ones from the svn branches) without merging the in run | or to get all the changes (including the ones from the svn branches) without merging the in run | ||
git fetch | git fetch github | ||
To update directly from svn run | To update directly from svn run | ||
Line 35: | Line 35: | ||
gitk --all | gitk --all | ||
[[Category:Software]] [[Category:Developer_Documentation]] | |||
Latest revision as of 18:16, 9 March 2011
How to use git with the paparazzi subversion repository. See the Git - SVN crash course for an introduction into git for svn users or have a look the pretty comprehensive git-svn intro for how to use git together with svn. To get an understanding off the git internals the video Getting Git is excellent.
Get the code
First clone the master repo from github as described here.
If you list the remote branches with git branch -r, you can see that you now have the subversion branches under github/svn/*. To update from this github mirror just run
git fetch
To be able to commit back to svn as well you will have to set this up. First make sure you have a proper svn-authors file (the AUTHORS file in the paparazi3 root dir has the correct format):
cp AUTHORS .git/svnauthorsfile
and tell git to use it
git config svn.authorsfile .git/svnauthorsfile
Since you only have the commits but not the SVN metadata you need to rebuild it. First make the all refs look just like they would look from a fresh import using git update-ref. To do this for all branches listed under github/svn/ you can run this small script:
git for-each-ref refs/remotes/github/svn/ | cut -d / -f 5- | while read ref do git update-ref refs/remotes/svn/"$ref" github/svn/"$ref" done
Tell git where to find the SVN repository and rebuild the index:
git svn init -s --prefix=svn/ svn+ssh://<username>@svn.savannah.nongnu.org/paparazzi/paparazzi3 git svn fetch
If you want to inspect your configuration work have a look at your .git/config file.
To get the changes from the master branch on the git mirror run
git pull
or to get all the changes (including the ones from the svn branches) without merging the in run
git fetch github
To update directly from svn run
git svn rebase
Gitk is your friend if you want to visualise all branches and history:
gitk --all