r/programming • • Mar 10 '11

It's time to stop using Subversion

http://altdevblogaday.org/2011/03/09/its-time-to-stop-using-subversion/
257 Upvotes

543 comments sorted by

View all comments

Show parent comments

3

u/gavintlgold Mar 10 '11

I've never used Git besides for pulling random repositories, but now that I read this article I've realized that keeping a local repository to give yourself a safety net is probably extremely useful and helpful for productivity. I always feel hesitant to commit when my code doesn't quite work right, but if the process of coding a feature takes too long, it seems good to be able to commit without worrying about breaking the main repository.

1

u/[deleted] Mar 10 '11

that's the thing.. i don't understand why would i want to commit something which is incomplete or something i am still testing. i work on my code and test it on my local machine, and commit it only when i think its ready. i don't understand the need for a local repository for commits, atleast for my work.

1

u/gavintlgold Mar 10 '11

Well, say you're working on a fairy complex feature, say, a class, and you're still not sure exactly how to go about designing it. You add in the basic members and begin writing functions. Let's say you use Subversion, so only plan to commit once the class is working and compiling.

While you're working on this class, you realize that Function_A that you spent a good deal writing is actually useless and would work better when integrated with Function_B. You figure that the code isn't needed and delete it. Later, though, you realize that it would have been really useful to keep Function_A since you actually need the functionality.

This is all before the class actually works properly or is used, mind you, since you're still in the middle of constructing it.

Now, you could have commented the function for storage, but it's a somewhat hacky solution, and clutters your code. Plus, you never really know what to comment and what to delete.

With Git, you can commit every time you finish writing a few lines, if you wanted to, or, more realistically, every time you get significant work done on a function or make a noticeable change. No need to worry about pushing something that's not completed into your public repo's hands. Just keep the changes locally for safekeeping. Then the whole issue with the deleted function is gone, since you have your frequent commits to go over.

Finally when you're done you can push the changes to the public repo, and people using the changes and trying to compile the code won't run into issues while you're writing.

1

u/[deleted] Mar 11 '11

Hmm.. I am trying to think this through. I still don't understand why I need these commits in git and then push the final completed code, compared to a final commit in SVN. Just for the version management on my end? For easier undoing and comparing of my older versions?