"Get up in the morning, wash yourself, put yourself in order - and immediately put your planet in order." This universal rule from Exupery is so flexible that it is one of the main principles even in IT.
Our planets are web products developed by teams of programmers and other IT specialists. To avoid chaos in the creation of new functionality, we use many different tools, among which Git plays a significant role.
Why you need Git
Git is a distributed Version Control System (VCS). Like any other VCS, it is designed to help team members collaborate most effectively by:
- tracking changes in source code and other text files within a collaborative project,
- making edits and controlling versions during development,
- returning to snapshots and finding issues.
Git is supported by a large community of developers and is one of the most popular version control systems. This popularity is not without reason, as Git distinguishes itself from many others with its methodology, which includes several key concepts.
A repository is the place where all versions of files and the complete history of interactions with source code are stored: who did what and when. The local storage of data is located on the computer, while the remote storage is on a server.
Commits represent snapshots of all changes to files at a specific point in time. This kind of recording allows you to revert to previous versions and roll back unwanted edits.
Separate branches in a repository provide parallel work on different features and fixes. Once the changes in one branch are ready, they can be merged with the modifications from another and with the main master branch of the project.
Why We Chose Git
Git has several advantages over other version control systems such as Subversion (SVN), Mercurial, and CVS.
One of the key differences of Git is its distributed model. Each team member has a full copy of the repository. They can work locally and make commits even when there's no network access. This is convenient for offline development. In other systems, often, you need to connect to a server to perform even basic operations.
Branching and merging in Git are powerful and flexible. Working with branches allows you to implement, combine, and manage different lines of development. Two or more programmers can work on the same feature simultaneously without interfering with each other. You can even create temporary branches for experimentation without affecting the main code.
Git not only shows the changes made but also who made them and when. The system's hashes and signatures prevent unauthorized access and ensure the integrity and security of data. When a failure is detected, identifying the responsible person helps understand why a particular change was made, allowing for refinement or removal if necessary.
In general, Git allows us to customize and adapt our workflow to our specific tasks. Many developers are already familiar with it, so they can quickly join projects and understand what's happening in them. It also makes it easier for newcomers to get up to speed, as they have a complete picture of how the web product is implemented, including its detailed transformations.
Issues with Git
Despite the fact that Git is considered an exemplary program in the rest, there are still a few points that create inconvenience when working with it.
In Git, there are some limitations when working on the Windows operating system, including the handling of paths and file names in Unicode. If a path contains characters different from ANSI, their support from the command line requires specific settings. Even with these settings, they do not guarantee the correct display of file names when using the same repository from other operating systems.
Git uses SHA-1 hashes to identify commits. This requires working with long strings instead of short version numbers, which are used in many other systems.
Git does not provide built-in mechanisms for automatic data backup, so users need to take care of data backup themselves. Significant time is spent on forming the history of a specific user file and searching for changes related to it.
It's worth noting that the benefits of collaborative work in Git outweigh the program's drawbacks. It's much worse when no VCS was used for the client's project. In such cases:
- it's impossible to trace the project's history for quick decision-making on enhancements;
- it's unclear who made what changes and when, making it challenging to direct questions to the responsible person;
- there's no concrete evidence that changes were made in the code, complicating the search for issues;
- difficulties arise in simultaneous development: two individuals may make changes to the same file on the server, and the version of the last one to commit will prevail.
Git is one of dozens of version control systems, but it has become their flagship. Whether to include it in your stack, consider another one, or abandon them altogether is a personal choice for each digital agency. Our experience has shown the significance of Git in projects, and we will continue to use it to maintain order on our "planets".