views:

1104

answers:

8
+8  Q: 

Migrating to GIT

What are some good resources and tips for migrating from SVN to GIT?

+1  A: 

I've found git stash to be my friend, as it basically allows you to rapidly compare before and after your current work in progress, eg.

...code code code...
run-tests > new-results
git stash # store current WIP
run-tests > old-results
...compare results :D...
git stash apply # restore WIP

I find this primarily useful for performance improvement/testing, but also for cases when i find a bug and want to verify that my current WIP isn't responsible.

Also if you're like me and use the git-svn bridge, then git stash && git-svn rebase && git-stash apply will update your working branch to svn HEAD, and bring reapply your WIP.

olliej
+2  A: 

Easy Git is a really nice wrapper to git that makes git behave a little more like svn -- or, at least, it minimizes unexpected behavior. He's got a page that helps you make the transition here. Lastly, you can add --debug or --translate and eg will show you the actual git commands being run. I highly recommend it.

Pat Notz
+1  A: 

Since branching is so easy and fluid in Git, I've found the GUI tools especially useful. Even the basic gitk tool (hint: use gitk --all). It can help you keep all the various branch and merge points straight. For what it's worth, I've never found tools like that useful for CVS or SVN... not until I switched to Git.

Pat Notz
+2  A: 

The PeepCode book "Git Internals" is a $9 PDF download that really helped me turn the corning in "getting" how Git worked.

The Git Casts website looks very useful too.

Pat Notz
+2  A: 

I thought that the git svn crash course was pretty helpful.

mk
+7  A: 

I think that the most important thing to understand about Git is the index (especially when used with add -i). I also found this page to be very helpful in understanding the importance of using the index and how it can allow for a very dynamic workflow.

Of course, there is also the Git SVN crash course (as mentioned by mk) and the Git Tutorial for some more general info.

Greg
+2  A: 

I find that using new tools on real work is the most effective way to learn:

After reading through some guides on Git and git-svn, clone an active SVN project with the git-svn bridge:

$ git svn clone <repo url>

Then, you can play around with the various git and git-svn commands while you're doing your regular work. Since you'll already be familiar with the source code (it's your project, after all), it will be easier to learn the suite of Git commands without getting distracted by contrived examples. Play around with checking out, committing, branching, merging, and tagging to really get a feel for Git's capabilities.

If you've done some productive work under Git, commit the updates back to SVN through git-svn:

$ git svn dcommit

For multi-user repositories, you can decide to stick with SVN as the central repository format, or replace SVN altogether with a "bare clone" of your local Git repository.

m104
+2  A: 

I highly, highly, highly recommend the Git Internals PDF and podcasts from PeepCode. It costs $9 but it does an excellent job of describing how Git works from a fundamental level. Once you understand that, a lot of all the other pieces will make a lot more sense. Whether your moving to Git from SVN, some other VCS, or starting from scratch it's really useful to "get" how Git works under the hood.

Pat Notz