This article describes how to maintain GRASS development workflow with Git against GRASS Subversion repository.
Text of this article is mainly inspired by Using Git to maintain GDAL workflow.
Git repository setup
First, initialize local Git repository for copy of trunk from Subversion repository:
git svn init --trunk https://svn.osgeo.org/grass/grass/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 two hours).
Next, fetch complete copy of GRASS trunk:
git svn --authors-file=/path/to/grass-git-authors.txt fetch
The file grass-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 230 MB of disk space. Git can compress it to about 90 MB. Git provides a dedicated command for this purpose git-gc:
$ git gc
You can bring your local Git repository up to date against GRASS 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.