Git is a distributed version control system used to track changes to a project’s source code. It was created by Linus Torvalds in 2005 for the development of the Linux kernel and is now widely used by software developers around the world.
Using Git allows developers to work together on a project collaboratively, as each team member can work on their own copy of the Git repository and then merge the changes into a single version of the source code.
Git’s inner workings
Its inner workings are based on the creation of a change database, called a repository, which stores all versions of the source code, along with the metadata related to each change.
Each time a modification is made to the files being tracked with Git, a record of that change is created, including information such as the author of the change, the date and time it was made, and a commit message describing the nature of the change. These records are stored in a version tree structure, which allows access to any previous version of the source code at any time.
Git also uses a branching system to allow multiple developers to work on different parts of the project at the same time without interfering with each other’s work. Each branch is an independent line of development that can be merged with other branches when the work is completed and approved.
In addition, Git uses a network communication protocol to synchronise repositories between different machines, allowing developers to work on the same project from different locations and share changes easily and securely.
In short, Git works by creating a database of changes, which is stored in a repository and allows version control, tracking changes, creating development branches and synchronising changes between different machines.
Git Key Concepts
A repository in Git is where all the source code and files for a project are stored. Repositories can be local or remote. A remote repository can be hosted on a server, such as GitHub, BitBucket or GitLab.
A commit is a record of changes made to the repository. Each commit has a unique identifier called a hash that is used to identify the commit.
A branch in Git is a separate version of the repository. Branches are used to develop new features or fix bugs without affecting the main version of the project.
Merging is the process of combining two different branches into a single branch. Merging is used to integrate work done in one branch into another branch.
A tag in Git is a name associated with a specific commit hash. Tags are used to mark specific versions of a project.
The basic workflow in Git starts with the creation of a new repository. Once the repository is created, developers can work on the project and perform commits on changes made. Changes can be reverted if necessary, and branches can be used to work on different versions of the project. Once work on a branch is complete, it can be merged into the main branch.
GitFlow is a popular workflow used in software projects. The GitFlow workflow uses two main branches: master and develop. The develop branch is used to develop new features, while the master branch is used for stable versions of the project. Additional branches are created to work on new features or fix bugs. Once work is completed on a branch, it is merged into the develop branch. When a stable release is made, a tag is created in the master branch.
GitHub Flow Workflow
GitHub Flow is a simplified workflow that is often used in small and medium-sized projects. The GitHub Flow workflow uses a main branch called main or master. Developers create a separate branch to work on a new feature or fix bugs. Once work on a branch is complete, it is merged into the main branch. Tags are used to mark specific versions of the project.
Using Git in Guardian
Guardian in a speetch
Guardian is a real-time cyber monitoring and reporting service focused on industrial OT networks. Through this service a user has a simple tool and an intuitive graphical interface for visualisation of alerts/incidents, devices, vulnerabilities in different devices.
Git’s contribution to the development team
- Collaboration: Git allows multiple people to work on the same project at the same time and collaborate more effectively, thanks to its ability to efficiently merge changes and resolve conflicts.
- Version control: Git allows you to track all changes made to source code, making it easier to identify and fix bugs, and helps maintain a detailed history of all project versions.
- Branching: Git allows you to create branches to work on different features or functionalities of a project, making it easier to manage changes and integrate new features into the main project.
- Error checking: Git, through a specialised platform, allows the execution of automatic tests when a branch is uploaded.
- Code approval: before each merge to the main branch, developers create a merge request, also called merge request, so that another developer checks the changes and, if everything is correct, merges both branches.
Git is a powerful and flexible version control system that allows developers to work on software projects collaboratively. With a solid understanding of Git basics and workflows, developers can use Git to manage software projects.