Version Control

Or how to not ruin your work

11/14/15

Version control is a very important aspect of coding. Without it, it would be possible to ruin weeks, months or even years of work with one accidental key-stroke. However with version control, and the liberal use of it, a coder will always have a recent, working version of their program that they can go back to if the changes that were made were undesirable. This isn't the only benefit of version control. Another example might be experimenting with different ways to implement the same functionality. You could have three different versions of a program that do the same thing and keep the one that works the best. These aren't the only uses of version control. Pretty much anything you can think of that involves having a previously saved copy of a project is what version control is all about.

One tool used for version control is git. Using the "git commit" command saves a version of your code with the changes you have just made. Inside git, every commit, or version of your code, is saved and available to review and/or jump back to that version of the code. This along with the description you should give every commit, allows a coder to keep track of changes made to the code. If you do this often, over time you will have many different versions of your code that you can jump back to, as well as a detailed list of all the changes you have made. Combine this with git's ability to make changes in a new branch, or copy of existing files and directories, and keep those changes separate from the master file until you decide to merge the changes makes git a powerful tool for coding.

Another tool used in conjunction with git is GitHub. This is a resource which allows you to store your code online. Just like git, GitHub also keeps track of changes made to the code over time. If you are wondering why you would want to do this when your project is already stored locally, the answer is collaboration. Uploading your code to GitHub allows other coders to make their own copy of it, make changes, and then submit those changes back to you to implement them or not. Whether this is done with a group of prearranged people, such as in this class, or with anybody out there by releasing your code open source, you can see the benefits of storing your code in GitHub.