|Version 5 (modified by mloskot, 3 years ago)|
Using Git to maintain GDAL workflow
This article describes how to maintain GDAL development workflow with Git against GDAL Subversion repository.
Note, this is not a complete guide of how to use git-svn, but a quick list of basic operations.
First, initialize local repository for copy of trunk form Subversion:
$ git svn init --trunk https://svn.osgeo.org/gdal/trunk/
The option --trunk explicitly specifies intention of this operation.
It is also possible to copy complete repository, including trunk, branches and tags modules. Learn about --stdlayout option dedicated for this purpose. However, note that this initial fetch is a time consuming process. (fetching of SVN trunk takes nearly one hour).
Next, fetch complete copy of GDAL trunk:
$ git svn --authors-file=/path/to/gdal-git-authors.txt fetch
The file gdal-git-authors.txt (attached) is used by Git to translate names of SVN committers to Git names which uses format "Full name <e-mail>". Specifying the --authors-file option is optional, but recommended.
It may be a good idea to compress Git repository in order to save some space. For example, SVN trunk occupies nearly 140 MB of disk space. Git can compress it to about 100 MB. Git provides a dedicated command for this purpose git-gc:
$ git gc
You can bring your local Git repository up to date against GDAL trunk any time.
$ git svn rebase
The rebase command is equivalent to svn update. Learn more about rebase in git-svn manual.
After this step, you maintain your own local repository of GDAL trunk. You can proceed with your own development, make changes and commit them to your local repository.
$ git commit -m "my big feature"
If you are GDAL committer, you can push your changes to GDAL Subversion repository directly from your local Git repository of GDAL trunk:
$ git svn dcommit --dry-run $ git svn dcommit
You can also push the local copy to your own Git remote repository to share your development experiments, then others will be able to clone it. For example, you can push it to Gitorious (yourproject and gdal-svn-trunk denote names of your own choice):
$ git push --all firstname.lastname@example.org:yourproject/gdal-svn-trunk.git
Note, if you are GDAL committer, clone of this repository will not allow you to issue git svn dcommit command to push your changes back to GDAL trunk. If you expect this functionality, you need to maintain Git repository of GDAL trunk on your own according to the steps described above.
(4.2 KB) - added by mloskot
10 months ago.
Git authors file to use with git-svn option --authors-file. Note, if this option is specified and git svn encounters an SVN committer name that does not exist in the authors-file, git svn will abort operation. The user will then have to add the appropriate entry. Re-running the previous git svn command after the authors-file is modified should continue operation.