Understanding version control
Version control for those who do not know, is exactly what it sounds like: tracking changes & keeping versions of your work or software. This allows the developer community to keep track of different changes to files, and work together more efficiently without affecting one another’s work.
When there are conflicts with two versions that need solved, this is called a merge conflict, which can be resolved usually by command line and a text editor. Yes, you can coordinate with your team, but chances are that one day you will experience these conflicts.
This post will outline why you should track everything you do (not only code, but everything) in version control. As by keeping version control, you can prevent disaster and view the history if needed.
For those of you who are experienced with version control, take this post as of an idea that perhaps there are more things that could benefit from version control. For those you who are new to version control, this will serve as a good post to explain some useful use cases of version control such as Git.
Tracking multiple versions of 1 file
When you use version control such as Git or Mercurial SCM, you keep track of the previous versions of the same file. If committed to the repository, you can access this history. This is useful because if you have a previous version of a file you need access to in the future, this is an option unlike before when you did not have a repository for a file.
This is actually much more common than one would think. Google Docs & other related services actually does the exact same thing. You have access to the repository and it’s previous versions by accessing their user-friendly versions menu. It shows the edit history and allows you to access the previous versions of your document.
So next time you create a file that is important to you, consider making a local repository!
When working with others, usually version control plays a huge part as to the branching feature. Multiple contributors can contribute to a single branch and keep the version history, but branching also allows other users to have their own version of the code or document that is being modified.
With other contributors, they may update the wrong version of a file, a pull request can merge the changes to the correct version
There might come a point where you made some minor modifications, but then you need changes from another contributor. However, the contributor contributed their contribution to a different version of the file, and now additional work is required to merge the work together.
There is a solution for merging work together that is much easier: pull requests & merging branches.
Usually, if there are no merge conflicts, then the merge should go smoothly, and this will update the correct version branch on the repository with the required additional contributions without issue or much effort. However, if there is a issue, usually it is easier to determine which changes to keep instead of having to locate the many changes the other contributor made.
Sperate production/releases from the development/evolving version
Let’s say you have a book (or web application), and you have a production version that is currently for sale. Down the road, you want to modify this book or web app to have more accurate information, but the changes will take some time to collect all the details and you may need to update copyright information or some other small changes.
With the separation of the production release from the development release, you can update a different version of the repository to only push what you need.
Restoration to previous versions
Finally, one final reason you might consider version control is for it’s very nature: previous versioning of your software/files. You can restore previous versions of a branch to retrieve information, or even reverse a mistake. Each version control software is different, so if there is a demand, I will make a post about git due to it’s popularity. Comment below if this is something that you need or are interested in.
If you use another version control software, send me a message or also tell everyone else about it in the comments as well!