|Version 10 (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 --authors-file=/path/to/gdal-git-authors.txt 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 email@example.com:yourproject/gdal-svn-trunk.git
Once local clone of a git-svn enabled repository is ready for the cycle of svn update and git push, the routine of updating mirror includes the following two commands only:
$ git svn --authors-file=/path/to/gdal-git-authors.txt rebase $ git push 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. Quoting one of best practices listed here:
For the sake of simplicity and interoperating with SVN, it is recommended that all git-svn users clone, fetch and dcommit directly from the SVN server (the remote SVN repository that is), and avoid all git-clone/pull/merge/push operations between git repositories and branches which are either retrieved via git svn clone and which are also used to push back changesets into the remote SVN repository.
This process may be time consuming, so an alternative is to use rsync to copy existing GDAL tree enabled with git-svn from another committer.
- Importing from Subversion on GitHub?
- git-svn manual
- Can different git-svn clones of the same svn repository expect to be able to share changes then git svn dcommit? on StackOverflow?
- Using Git for SVN Repositories Workflow
- Howto use Git and svn together
- Using git to maintain Subversion branches
- git-svn in 30 minutes
(4.3 KB) - added by rouault
38 hours 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.