Finding out about Git, feeling like I discovered fire

Today I discovered (by myself, although friends who are also software developers have already told me about it) Git. Git is a version control system . . . and up to this day, I didn’t have any idea what that means.

Here’s the thing. Let’s say that you need to develop code that stretches to many possible .c, .cu, .m and other files. Normally, a big code like that will need a varied amount of debugging (inversely proportional to the skill of the programmer, but still). You may also want to try new ideas on your code after a while until, oops, something breaks!

Then the problems begin. If you haven’t kept any backup, you have to search back to find all the changes you’ve made to all the files you’ve made them and try to work your way back to a code that works. Keeping backups of the code is an extra problem that gets in the way of development and also makes the programmer more cautious. I wasn’t too eager to try a lot of new ideas on my code, mostly due to fear of introducing errors to my code. So, I tried to keep the different versions … separate.

So, each time that I changed a few of my files, I created a new folder and moved the modified files in it.

My primitive version control system

Although this idea kind of worked, I couldn’t but wonder. Is this the way that real developers do this? Even if they have hundred of different files and they change most of them while they work? Do they have to do this whole work of moving the different version of files in another place, so that they don’t have to trace back their mistakes or their ideas?

And then, I discovered Git.

Git is a program that can run on almost all the operating systems and it’s job is to keep track of the changes for you. The main idea is that it creates a folder inside the directory where you keep your files. Then, using the simple command add * you can tell git that you want it to track the changes of the files in that directory. Then you can choose, again using add, those files that you want to keep a backup of and write a message that will help you understand (in the future) what changes you’ve made to this version. Then, if at some point you do something bad, you can easily revert back to whichever version you like. This is hardly a good explanation of what this tool can do. I am really looking forward to learning more about it.

The git dedicated site has all the information someone would need. You can find it here along with explanations on everything this “little” program can do.

Cheers! 🙂

Advertisements