Ask HN: Is version control worth learning early on?
Just spent two hours writing a 25line Python script. First real script, totally happy and pleased with myself. But what do I do with it?
I am planning on storing it in my personal Dropbox so I can edit it or create more on which-ever computer I own, but my question is: would it be worth it to learn Git/SVN now, in the early stages of programmer-hood, or later down the road. Would I benefit from learning/using Git/SVN now? Or would I benefit more from ignoring Git/SVN and just focus on writing code. Thanks.
82 comments
[ 3.2 ms ] story [ 123 ms ] threadYou don't have to learn all the ins and outs. I don't know git very well yet. Basically to start use
git init
git add -A
git commit -m "yay, another submit"
Also a .gitignore file might be useful
A night or two spent on learning how to use git (and maybe setting up a remote repo) will save you tons of headaches later and produce lots of benefits almost immediately.
I've never found myself thinking "I wish I didn't have that version from before that big last change" but I have thought the opposite.
There are so many life-altering tools available for developers now; far more than were available when I started programming. Unfortunately, the longer you build up bad (or simply inferior-to-current) programming practices, the harder it is to apply new, better techniques. Integrate them into your life now and you'll have a sturdy, solid foundation to build on.
http://software-carpentry.org/
I'd go so far as to say that every developer should know everything on this page, or at least some substitute (e.g. mercurial instead of svn, ruby or c instead of python).
If you've written a 25 line script, write a 100 line or 5000 line one. And have fun. You already understand the importance of versioning and having reliable backups. Assuming your goal is to become a programmer rather than a book-keeper, stick to the programming for now.
The thing is that learning version control is well worth the hassle of version control for someone trying to become a programmer.
One of my favourite interview questions to ask is, what version control systems have you used. I don't really care if it's not what we use. But someone who can't talk fluently about whatever system probably hasn't worked on a large project, probably hasn't worked as part of a team, and probably hasn't had experience dealing with regressions. That's a red flag.
I always ask what the applicants favourite editor is. Not because they have to use The One True Editor, but because they definitely should have one they prefer (which implies "know"). Craftsmanship warrants knowing your tools.
http://www-cs-students.stanford.edu/~blynn/gitmagic/
When you work with teams, in particular, being competent with your revision control system is mandatory. You'll be surprised by how easy it is to pick up the basics, if you just make yourself do it. The Subversion book is quite good both from a conceptual, as well as specific technical perspective; we've just started moving our projects to git (and I've been using VCS of one form or another for more than a decade), so I don't have a good notion of what the git docs are like for complete VCS newbies.
Anyway, create an account at github, follow the tutorials and docs they provide, and you'll be able to do most everything you need. I don't think Subversion will be going away any time soon, but DVCS is definitely rising quickly, and most new OSS projects are starting on git or another DVCS.
If I had to do it all over again I would try to find the very basic functions that I have to use and a few graphics explaining how it's structured.
http://www.eecs.harvard.edu/~cduan/technical/git/
But what you choose does not really matter. Learn a revision control system.
That being said, I did use vc (cvs, uggh) from pretty early on, but I still got burnt a few times when I forgot to check in or damaged my repos.
No. That way, when you have a crash and are severely injured, you'll realise that you should have been wearing a seatbelt!
Irony is judged by how artfully it approaches the line of apparent total sincerity without going over. Your response is clearly ironic. But it's possible to imagine, for a few seconds during the first reading, that the OP is being serious. Only after you think about what he just said do you start laughing.
Guh, reminds me of what my friend used to do. He'd be acting all excited and say "Did you hear? Nine Inch Nails is having a concert here next month!" and I'd be like "Wow, cool, I want to go!" and then he'd crack up laughing and say "I can't believe you thought I was serious".
edit: he didn't deserve to be downvoted .. wtf. Maybe downvoting should cost the downvoter a point too, like on Stack Overflow. Would be an interesting experiment.
i know for a fact that youtube for example did not touch version control early on. you should definitely appreciate speed when you're starting because your ideas could change (and your code).
it's a trade off, and eventually you'll start doing stuff like unit testing. at some point, the more time you spend perfecting your code, the less time you can spend prototyping and changing the idea if it needs to be changed. i don't think it's comparable to a "wear your seatbelt, you should ALWAYS be using version control in EVERY situation" thing, you should really think about whether you need it. you should worry about hard disk failures, so do a back up every once in a while with a flash drive or dropbox at the very least. but version control has its own learning curve.
I would guess most people on their second startups enable version-control from the beginning.
With version control you're always safe in the knowledge that whatever you do, you can always 'revert' to the last version that worked.
svn add newFiles
svn commit -m "I did something"
There's not really all that more to learn, just check the docs or "svn help" but it'll certainly be well worth your time to get into the habit.
For some reason I have an instant distrust of anything mousey - seems like a barrier between me and what is really going on. But as you say good option for those who prefer working that way :)
Git on Windows, how to install and use it (or see below for Tortoise git)
http://www.gitcasts.com/posts/git-on-windows
Mov: http://media.gitcasts.com/c10-windows-git.mov.zip
If you use the Git GUI from Msysgit to clone a repo please use the following credentials: ...
Tortoise Git is a easy solution which is thought to integrate into e.g. Explorer etc. Please see here for details:
http://code.google.com/p/tortoisegit/ (first install msysgit then this..)
Linus Torvalds on Git (a more detailed introduction) http://www.youtube.com/watch?v=4XpnKHJAok8
Git usage: ----------
Most interesting is for git is that "Branching" is very cheap. This means that if you want to implement feature X you just "branch" the repository (e.g. local or remote) and don't affect the main branch until you want to merge your code back into main.
Cloning: ---------
1.) Open e.g. Git Bash
2.) Go to the folder where you want to store the repository
3.) git clone ssh://IP:PORT/REPONAME.git TARGETDIR
4.) It will ask you for your ssh key. (please see the above video (.mov) for details).
Later then you can test things by just changing something slightly and recommiting it, e.g.
1.) cd TARGET
2.) vi README
3.) git add *4.) git commit
Added some more 5.) git push Have fun !1) Do it because it will give you a huge piece of mind (backup & history)
2) Do it because you can code review (git diff) the whole feature before committing it, rather than doing it one line at a time and hoping you'll achieve stability in the future.
svn up svn st svn rename svn add svn remove svn ci
that's all I need to know and I've got by with just that for years.
version control is so essential to the way I work now that I can't even fathom working without it. it's not just about version control for me (I very rarely need to "roll back" code etc), it's more about security, having access anywhere I want (my repositories are remote) and being able to deploy sites with just one line of code instead of faffing over what has changed and what hasn't on the live server.
I would recommend you just learn how to set it up and learn a few basic commands like checking in and updating and then see if using them in your workflow helps at all.
If you work on any collaborative projects you'll probably have to use it, but just the basics.
As far as all this talk about good habits, etc. Its all bullshit. Its a tool. If it solves a problem use it, if it doesn't don't sweat it. And when you are eventually forced to use it, just learn a few commands or ask for help. Its really no big deal.
Why wait? Here's a few reasons: 1. If you've only written one script, then your time is better spent learning and working on interesting programming problems.
2. Dropbox includes basic version control. It's more than adequate for a few scripts, with the advantage of being automatic and dead simple.
3. Version control is a pain in the ass. Installing software, setting up ssh keys (if working with a remote repository), and learning the commands was exceptionally boring for me.
There's no need to experience this tediousness right now -- just dig into whatever is the most interesting to you!
Don't get me wrong, you can become a master at certain VC systems and do all sorts of neato stuff with them, but you should focus on getting the bare minimum down (enough to just replicate what you are already doing on dropbox, which should take you a few hours max), and then get back to programming. You will learn the rest along the way. At some point you will say "oh man, I can't believe x happened", or "I really wish I could look at my code this way", you'll ask someone for help, and since you were using a version control system all along, you will be able to do it.
Think of it more like getting a proper text editor to replace notepad rather than "learning" something brand new.
It's easy to do and will save you a whole load of ballache down the line.
Our front end designers picked it up pretty easily so it can't be that hard :P
I work as a release engineer, and the sheer number of f*-ups that could be avoided by dev's understanding version control better is truly astonishing.
It doesn't matter very much which version control system you use (though there are a few which will give you a pounding headache) it's more important you understand a few useful processes, like merging and conflict resolution, branch strategies (e.g. feature branches, release branches, does HEAD == all source-code?, etc, and why you'd use one or the other) check-in style (e.g. larger chunk(s) with peer code-review?, frequent updates that allow you to follow your thinking at a later date?, pre-submit unit-tests?) among a few other things.
Even though not all of these things will be needed by your project(s), knowing those things in-advance are what will allow you to use a VCS effectively, even if you work alone.
Concerning the question itself: yes. Yes. YES!
I definitely recommend learning version control as soon as possible. It's a life saver, and it's incredibly easy. With mercurial you're up and running by typing 'hg init'. That's it.
And then you get to experience the satisfaction of 'hg commit'. Maybe I feel like this because I've been burned by not using control version system a long time ago. But really, as soon as I've done a commit, I just feel at peace: I can throw myself in large refactoring (unit test helps too), try something that will probably not work and break everything. It doesn't matter because it's so easy to backtrack.
You can do the same with copy paste. But it takes much much more time. It's just too much of a hassle. And it doesn't scale with teams of more than 1 person...