As a super git fan, I wish every repository in the world be a git repository. However, we are not in an ideal world, and from time to time we run into other types of SCMs, and we have no choice but to use them. I guess the chances of encountering subversion and perforce repositories is pretty high, because they are popular as a free tool and a commercial tool respectively.
Now, being a heavy user of subversion before I "svn switch" to git, I have not problem dealing with subversion repositories when I have to, but that doesn't mean I don't miss git when I'm doing so. Fortunately, git comes with a built-in tool, git-svn, that allow us to use git as a svn client. Here is a very brief introduction to git-svn.
# like svn checkout, but it creates a local git working folder
git svn clone //trunk
# normal git commit as we do with git repositories
git commit -a -m "first commit"
git commit -a -m "second commit"
# this command submits the new git commits to svn repository
git svn dcommit
# like svn update
git svn fetch
For more information on git-svn (e.g. branching and merging), go to http://www.kernel.org/pub/software/scm/git/docs/git-svn.html.
Some big organizations didn't mind paying for a commercial SCM tool, and here we are stuck with perforce. But again, we are fortunate because git has recently added support for git-p4 too. Note that this feature has only been included to the git tool recently, so we need to make sure we are having the latest version. Here's the version I'm using.
git --version
git version 1.7.12.3
Here's how you use git-p4. Note that git-p4 doesn't help us setup the p4 config files, we still have to do it ourselves.
# suppose we have our p4 config file setup properly.
$ p4 login
# to clone, but it creates a local git working folder
git p4 clone //depot/main
# normal git commit as we do with git repositories
git commit -a -m "first commit"
git commit -a -m "second commit"
# to push change to p4 server
git p4 rebase
git p4 submit
# to fetch changes from p4 server
git p4 sync
For more information on git-p4 (e.g. branching and merging), go to http://kb.perforce.com/article/1417/git-p4.