1

like for example i am doing ruby on rails and using git for version control.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
Pisto
  • 171
  • 1
  • 3
  • 15

4 Answers4

3

I use git as a sole developer an I could not imagine life without it. With git, I always know what I am doing and what I have modified. I can make experimental changes without fear of not remembering what I changed. I can look at old versions of files in case I deleted something that now I want back.

I can always go to my terminal and type git status and see what files I have changed. I can type git diff to see those changes. If I decide my changes are no good an I want to go back to where I was I just type git checkout ..

Nick Moore
  • 15,547
  • 6
  • 61
  • 83
3

The best part about Git is unlike other source control systems, Git can work offline. Doesn't matter whether you are on a plane or at home or some distant place with no connectivity. You can still commit changes to your local git repository & push it to centralized server (if you have one) when you are connected. One more thing which makes Git very powerful is 'Branches'. If you want to do a bug fix or want to try something new without harming your current working code, just create a branch & work on it. When things ae working fine in your branch, you can merge it to the master branch.

I would say Git provides more flexibility than anything other SCM.

hnprashanth
  • 791
  • 7
  • 23
2

Version control systems really shine when you're working with another person, or thousands of people; as people work on files, chances are good they'll work in similar spaces. Source code control systems let you merge changes from multiple developers into one coherent product, roll back mistakes, figure out who wrote which specific lines of code (to ask them why their code doesn't work two months later), provide excellent business continuity, etc.

But they are still wonderful with just one developer: check in comments about why you did something in some particular fashion can be worth their weight in gold six months later. You can checkin large changes that depend upon four separate files all at once, and then, if you need to undo it, one single command will back out the changes on all four files at once.

sarnold
  • 102,305
  • 22
  • 181
  • 238
1

Version control systems allow you more easily track changes to files ... so say you edit a file and commit it to the system a couple of times in a week ... if something breaks, you can go in and see all the specific line by line changes you made to that file over time, until you find the change that caused the problem ... much harder if you're saving different copies of your file right? (This feature is so awesome that I know authors who use it to track changes to books that they are writing!)

Where it really shines, though, is a situation where different developers are working on a particular file at the same time ... so if I edit lines 1- 20 of a 400 line code file, and you edit 97 - 143, the version control system can merge those changes together so that when you go to do an update, you get my changes merged into your file and can see how my code affects what you've written if any.

Even better, if we've worked on the same lines of code the version control system will try to merge those changes, and if it doesn't it will warn you of the conflict ... then you can get with the other developer and figure out how to merge your changes manually. Of course with version control you're usually working on a bigger piece of software, so you can also pull in updates to other files that you aren't working on directly either.

With git, you get one other really killer feature that makes developers swoon ...

Say you are working on your code, diligently trying to add a feature to your software, bu you get an emergency call, 'PLEASE FIX XYZ, THE SITE IS NOT WORKING!"

Without version control, you'd have to go comment out all the stuff you just added, then try to fix the problem, and if you forgot something somewhere, it might cause even more problems as you try to hunt down the new bug that you introduced because you didn't remember all the new code you wrote (can you tell I've been there before?) ... with Git, you can simply 'branch' (create a different kinda virtual copy of your code) ... and work on your new feature ... then when that 3am call comes in, you can just switch back to the main stable branch of the software, commit the fix, push it live ... then go back to working on your feature.
very fricking nice right?

There are lots of other things you get with version control systems (specifically git) for free, (built in ability to compare version of the same file, localized copy of the entire code base with git, ability to change commit messages and history etc etc).

I'd recommend the free Git community book to help you along
https://github.com/rails/jquery-ujs
Hope this helps

concept47
  • 30,257
  • 12
  • 52
  • 74