Earlier, an Artemis blog post provided An Introduction to GIT-SVN. Now, we would like to share some quick commands to get your GIT-SVN-based project up and running.
Some of the more important commands are listed below.
Clone the repository:
1. git-svn clone – s https://repo.mydomain.com/my_subversion_repo local_dir.
The -s is there to signify that the Subversion repository has a standard layout (trunk/, branches/, and tags/). If your repository doesn’t have a standard layout, you can leave that off.
If we need to synchronize the remote repository with the local repository, we execute the following command:
2. git-svn rebase
The above command fetches any changes that have been made and merges them into your local branch.
3. git-svn show-ignore > .gitignore
This command downloads any “ignores” from SVN (The files/directories which SVN will not include on the repo) and generates the .gitignore file for the local repository.
Once we complete these steps, we can work with the local repository like any other git repository with commands like commit, branch, checkout, etc.
When we finish the changes we have made, we can commit the changes to the server using the following command:
4. git-svn dcommit
If you wish to work with a different branch (by default, you clone the trunk branch) you need to run this command:
5. git checkout -b local_branch origin/remote_branch
The advantage to using a GIT repository is that you can create local branches to develop new features even if you don’t have internet connectivity and merge your changes with the master branch if you are working with the trunk SVN branch, or you can merge with another branch if you don’t want to synchronize with the trunk yet. Hope this helps you get a better sense of GIT-SVN and GIT command usage.