Switching From SVN to Git
I’ve been using SVN for several years now, so I’ve been partial to it, and reluctant to switch to another form of source control. I’m very comfortable with it, and I’ve got dozens of scripts to augment it and help me deal with it’s shortcomings, as well as a few blog posts.
- Easier to create a repository from existing code.
This is the first thing I noticed about git that absolutely crushes subversion. With subversion, you have a repository that you check files out of. With git, you can literally create the repo while you’re in a directory.
The above line creates a new repository for you in your current directory. Everything in there is now under version control. It’s awesome. So simple and elegant.
- Git stash is really, really cool.
It’s nice to see that other people encounter the same problems I do when using SVN. I’d be working on something, need to switch to a different branch, but I don’t want to commit my work. It’s not done, and I didn’t create a branch to start. Yes, I should have, but I thought it would be less than an hours work, and SVN’s merging kind of blows. So I didn’t.
Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.
Yes, there are ways around this in SVN, but it’s still a pain to merge in changes when I’m done. Merging in your temporary stash is simple:
git stash apply
On my first day using git, I had already used this feature. Very handy.
- I finally understand why I’d want the entire log on my machine.
I’ve always worked out of an office where my repo was on a gigabit line and was sitting nearby. I also was usually SSH’ed into the machine so I could just do the commands remotely and see the output. However, I’m doing some work over a VPN, and using SVN is incredibly slow and annoying. It’s also over http only, so I’ve lost my sweet file:///. Git absolutely crushes SVN here.
- **The git client supports SVN. **
It’s nice that I don’t need to migrate everything over right away. I like making commits that aren’t shared with everyone right away, since I might do a lot of work that I consider valuable, but doesn’t end up compiling or working at all. I realize I could branch here, but I’m not always on top of things. This ties into the stash mentioned above.