今日推荐英文原文：《Git: No Control Without Version Control》
今日推荐英文原文：《Git: No Control Without Version Control》作者：Kudzanayi Dzvairo
Git: No Control Without Version ControlI’ll be writing a few blogs on git and some of its features as it was something I googled often working with partners on projects when I began coding. But before diving into git…
What is Version ControlVersion control systems allow software teams to manage changes to source code over time. Version control software keeps track of every change over time in a special database. This allows developers the opportunity to turn back time and fix mistakes and make comparisons with the least amount of distraction the team.
As developers code is the most important asset to a team and has been composed carefully. Version control protects source code from both deliberate and unintentional mistakes.
Developers work in teams and are continually updating old code and writing new code. The code for a project, app or software is organized in a folder called structure called a ‘file tree’. This allows developers to work on multiple things at once. One may be working on a new feature while another fixes a bug
Version control helps teams solve these kinds of problems, tracking every individual change by each team member 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 without blocking the work of the rest of the team. On top of that 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.
Benefits of Version ControlDeveloping software without using version control is risky, like not having backups. Version control can also enable developers to move faster and it allows software teams to preserve efficiency and agility as the team scales to include more developers.
- 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. 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 at the same time 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 with root cause analysis. 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.