# What is version control Version control, also known as *source control*, **is the practice of tracking and managing changes to software code.** Version control systems are software tools that help software teams manage changes to source code over time. **As development environments have accelerated, version control systems help software teams work faster and smarter.** They are especially useful for DevOps teams since they help them to reduce development time and increase successful deployments. Version control software keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members. For almost all software projects, the source code is like the crown jewels - a precious asset whose value must be protected. For most software teams, the source code is a repository of the invaluable knowledge and understanding about the problem domain that the developers have collected and refined through careful effort. Version control protects source code from both catastrophe and the casual degradation of human error and unintended consequences. Software developers working in teams are continually writing new source code and changing existing source code. The code for a project, app or software component is typically organized in a folder structure or "file tree". One developer on the team may be working on a new feature while another developer fixes an unrelated bug by changing code, each developer may make their changes in several parts of the file tree. Version control helps teams solve these kinds of problems, tracking every individual change by each contributor and helping prevent concurrent work from conflicting. Changes made in one part of the software can be incompatible with those made by another developer working at the same time. This problem should be discovered and solved in an orderly manner without blocking the work of the rest of the team. Further, in all software development, any change can introduce new bugs on its own and new software can't be trusted until it's tested. So testing and development proceed together until a new version is ready. Good version control software supports a developer's preferred workflow without imposing one particular way of working. Ideally it also works on any platform, rather than dictate what operating system or tool chain developers must use. Great version control systems facilitate a smooth and continuous flow of changes to the code rather than the frustrating and clumsy mechanism of file locking - giving the green light to one developer at the expense of blocking the progress of others. Software teams that do not use any form of version control often run into problems like not knowing which changes that have been made are available to users or the creation of incompatible changes between two unrelated pieces of work that must then be painstakingly untangled and reworked. If you're a developer who has never used version control you may have added versions to your files, perhaps with suffixes like "final" or "latest" and then had to later deal with a new final version. Perhaps you've commented out code blocks because you want to disable certain functionality without deleting the code, fearing that there may be a use for it later. Version control is a way out of these problems. Version control software is an essential part of the every-day of the modern software team's professional practices. Individual software developers who are accustomed to working with a capable version control system in their teams typically recognize the incredible value version control also gives them even on small solo projects. Once accustomed to the powerful benefits of version control systems, many developers wouldn't consider working without it even for non-software projects. #### Benefits of version control systems Using version control software is a best practice for high performing software and DevOps teams. Version control also helps developers move faster and allows software teams to preserve efficiency and agility as the team scales to include more developers. Version Control Systems (VCS) have seen great improvements over the past few decades and some are better than others. VCS are sometimes known as SCM (Source Code Management) tools or RCS (Revision Control System). One of the most popular VCS tools in use today is called Git. Git is a Distributed VCS, a category known as DVCS, more on that later. Like many of the most popular VCS systems available today, Git is free and open source. Regardless of what they are called, or which system is used, the primary benefits you should expect from version control are as follows. A complete long-term change history of every file. This means every change made by many individuals over the years. Changes include the creation and deletion of files as well as edits to their contents. Different VCS tools differ on how well they handle renaming and moving of files. This history should also include the author, date and written notes on the purpose of each change. Having the complete history enables going back to previous versions to help in root cause analysis for bugs and it is crucial when needing to fix problems in older versions of software. If the software is being actively worked on, almost everything can be considered an "older version" of the software. Branching and merging. Having team members work concurrently is a no-brainer, but even individuals working on their own can benefit from the ability to work on independent streams of changes. Creating a "branch" in VCS tools keeps multiple streams of work independent from each other while also providing the facility to merge that work back together, enabling developers to verify that the changes on each branch do not conflict. Many software teams adopt a practice of branching for each feature or perhaps branching for each release, or both. There are many different workflows that teams can choose from when they decide how to make use of branching and merging facilities in VCS. Traceability. Being able to trace each change made to the software and connect it to project management and bug tracking software such as Jira, and being able to annotate each change with a message describing the purpose and intent of the change can help not only with root cause analysis and other forensics. Having the annotated history of the code at your fingertips when you are reading the code, trying to understand what it is doing and why it is so designed can enable developers to make correct and harmonious changes that are in accord with the intended long-term design of the system. This can be especially important for working effectively with legacy code and is crucial in enabling developers to estimate future work with any accuracy. While it is possible to develop software without using any version control, doing so subjects the project to a huge risk that no professional team would be advised to accept. So the question is not whether to use version control but which version control system to use. source : https://www.atlassian.com/git/tutorials/what-is-version-control # History of version control system ![](https://i.imgur.com/1Z3mkqH.png) Version Control timeline(2).pngA timeline of version control systems from the early 1960s through the early 2000s # 1960s The predecessor of modern version control tools was IEBUPDTE, which was used with IBM's OS/360. It was developed in the early 1960s and primarily used punched cards to store data. While there is some debate over whether IEBUPDTE constitutes ‘true’ version control, it did provide the ability to create and update libraries of code in a way that’s similar to today’s patching systems. # 1970s In 1972, Bell Labs made a breakthrough in the field of version control. They created **SCCS (Source Code Control System)**, which was written in C and developed by Marc Rochkind. This system shared many characteristics with modern version control systems such as the ability to create, edit, and track changes to files. However, **it lacked the ability for more than one user to check out and work on a file at the same time.** SCCS was made available to the public in 1977 and was the primary version control system into the early 1980s. # 1980s In 1982, Walter Tichy developed a new system called RCS, or Revision Control System. **RCS still only allowed one user at a time to make edits and only supported the ability to work on single files**, rather than a whole project. **However, it did pioneer a new way of tracking changes called reverse deltas.** Rather than store all of the versions of a file, RCS used a single recent version as its baseline from which all other versions were created. For the time, this was a faster and more efficient way of tracking changes. A few years later in 1986, Dick Grune developed **CVS (Concurrent Versions Systems)**, which was also written in C. **CVS finally allowed more than one developer to work on a file at the same time.** Users would deploy the UpdateVersion command to update a file to the latest version of that file on the server. **CVS used delta encoding or compression, which tracks differences but not entire versions of files.** With its use of a client-server model and branches, CVS is a much more modern example of version control. # 1990s to present The next major version control system was **Subversion (SVN)**, which was created in 2000 by CollabNet. SVN preserved many of the features included in CVS so that users could easily transition between the two. By 2010, SVN was renamed Apache Subversion after it became part of the Apache Software Foundation. SVN is an example of a **centralized version control system (CVCS)**. Changes are made to a single copy of the project on a server and other users can pull down the latest version of the project to make their edits. **There are many Subversion clients still in use today, such as Tortoise SVN and SmartSVN.** However, CVCS has been eclipsed in recent years by a more modern form of version control: **the distributed version control system (DVCS).** This brings us to the present. Currently, the most well-known DVCS is Git, which was created in 2005 by Linus Torvalds. The basic logic behind a DVCS is that a copy of the repository and its history is downloaded by every user. Systems like Git are known for being fast and reliable, with good branching capabilities. For now, it seems that DVCS is the future of version control, but as repositories continue to grow in size, it may be necessary to innovate even further. Source : https://blog.tarynmcmillan.com/a-history-of-version-control # Version Control — Why Do We Need It? Complex code development is impossible without a Version Control System (VCS). Version Control is used to track and control changes to source code. It is an essential tool to ensure the integrity of the codebase. ### Why is Version Control Essential? #### Easy Modification of the codebase Software development includes the continuous process of modifying programs and version control system makes this task easier. Version control software is used by software developers to maintain documentation and configuration files as well as source code. It helps developers to store different versions of software safely and in an organized manner. With this, a Software Engineer can quickly identify which version needs to be modified and what commits had been done previously and should be done. #### Reverting Errors Version control can be an excellent help for emergency hot-fixes, routine maintenance, upgrades, and new features with potentially overlapping development timeframes. When you need to troubleshoot an issue, you can easily access and compare the last working file with the faulty file, and decrease the time spent identifying the cause of an issue. You can restore older versions of a file (or even the whole project) effectively through the use of version control systems. You can simply undo every commit you have done in just a few clicks. #### Collaboration Programmers and developers can easily collaborate on a project through the version control system. Everyone can access the database simultaneously to view previous versions. It will be easier for them to work simultaneously as a team regardless of their location. Version control allows developers to store the history of changes and who made them, enabling them to revert or look back to previous versions of documents and understand how contributions by different contributors have changed the project over time. When working with multiple collaborators, understanding what commits are being incorporated into the repository and why commits were pushed are crucial to avoid breaking one another’s source code. Collaborative environments ( like GitHub, GitLab, etc.) developed around version control systems provide central repositories, issue tracking/management, and threaded discussions/forums which helps facilitate a team-based approach to the software development lifecycle. #### Backup A distributed VCS acts as a backup. If a central server does down, a developer can retrieve one of his/her teammates’ local VCS repository. However, take note that VCS is not generally a backup system so do not cram files on your remote server. #### Version Control Best Practices ## To reap the benefits of using VCS, remember these best practices: Commit early and commit often. This will help you make your commits small and limited only to related changes. Make small changes but do not commit unfinished work to avoid breaking the build. Document everything. Provide a short description of the changes that have been done every time you save a new version. This will help you understand how your project evolved between versions and store versions correctly. Write a good commit message with a short summary of your changes (up to 50 characters as a guideline). The summary should provide details on the intent and purpose of the changes and how it differs from the previous implementation. Link code changes to work items for the changes’ traceability. Test before you commit. Make sure that a commit is thoroughly tested before implementing to ensure that it has no side effects or errors. Do not share untested commits with other developers. Comply to agreed conventions and workflow and be a team player. Consistency helps ensure quality making it easier for the whole team or other developers to review code, debug, or make other modifications. Version control is essential to track, organize and control changes over source code and avoid confusion, especially for large, fast-changing projects. Version control systems are essential tools when integrated with a well-defined version management process. Free version control systems are commonplace so there’s no reason to not use one. source : https://medium.com/@lanceharvieruntime/version-control-why-do-we-need-it-1681f4888cec