Git as a DevOps Tool
Published: 2023-05-26 22:10:48

I know when we say Git what comes to the mind  of most beginners is Github. Well just to make it clear, Github or bitbucket are built on top of git with some additional functionalities that help with hosting and version control of code in the remote Git repository.

Git provides developers with shared workspace hence visualization of works is made easy. It comes with good integrations to work with CI/CD tools.

## Why Git is needed in DevOps
**Effective CI/CD Discussions with Developers**

- As a DevOps engineer you design and develop CI/CD pipelines and Git plays a vital role in having productive discussions about Continuous Integration and Continuous Deployment (CI/CD) with developers.
 
Git is essential in this context:
 

- It enables seamless **collaboration** among developers, facilitating discussions on merging changes, resolving conflicts, and integrating code during the CI/CD pipeline.

- Git's branching feature allows developers to work on separate branches for different features or bug fixes**(git branching)**. This supports discussions on branch readiness, **code review,** and ensuring quality code integration.

- Git stores **deployment configurations**, such as infrastructure as code files and deployment scripts. Discussions can involve reviewing and modifying these configurations to ensure smooth deployments in the CI/CD pipeline.

- Git helps **manage release** versions and tags, enabling discussions on release planning, versioning strategies, and feature inclusion. This ensures a coordinated approach to releases within the CI/CD workflow.

**Infrastructure as Code**

- Development and maintenance of infrastructure code is done in Git and the it is important to note that infra code is treated the same as application code hence it goes through unit testing and integration tests before deployment to environments. This means that infra code needs CI/CD pipeline which translates to git-based workflows.

- With Git, you can manage changes to your infrastructure code in a controlled and auditable manner. Each change is tracked, allowing you to understand who made the change, when it was made, and why. This helps maintain a clear history of modifications and simplifies change management processes.

- Git facilitates collaboration among team members working on infrastructure code. Multiple developers can work on the same codebase simultaneously, enabling seamless collaboration, code review, and the ability to merge changes efficiently.


**Gitops**

GitOps uses Git as the one point of truth to control the deployment of infrastructure and applications. Git plays a crucial part in GitOps by offering features for version control and collaboration

- GitOps uses a pull-based methodology, in which the system's ideal state is specified in Git and changes are constantly compared to the real state. As the only source of truth, Git repositories, the GitOps tools extracts the desired state from Git and applies it to the target. 

- GitOps uses the branching capabilities of Git to handle several environments. In the Git repository, each environment (such as development, staging, and production) is allowed to have a separate branch. As a result, distinct workflows, change isolation, and controlled promotion of settings and applications between environments are made possible.

- Git's pull request and code review functions are advantageous to GitOps. A review procedure can be applied to changes to deployment manifests and infrastructure code to guarantee best practices compliance and code quality. Reviewers can comment on modifications, debate them, and make sure that only those that have been authorized are merged into the main branch and released.

## GIT ROADMAP

- [Understand Version Control System ](https://www.atlassian.com/git/tutorials/what-is-version-control)

- [Understand Distributed Version Control](https://about.gitlab.com/topics/version-control/benefits-distributed-version-control-system/)

- [Git Installation](https://git-scm.com/downloads)

- [GUI Clients](http://git-scm.com/downloads/guis)

- [Git basics](https://git-scm.com/videos)

- [Fundamental of Git](https://gitimmersion.com/lab_01.html)

- [Advanced Git](https://www.atlassian.com/git/tutorials/advanced-overview)

## Learning Resources
1. [Git and Version Control Guide](https://www.educative.io/courses/guide-to-git-and-version-control?aff=KNLz)
2. [Udacity Version Control with Git](https://devopscube.com/recommends/git-basics-2/)
3. [Udemy step by step guide to Git](https://devopscube.com/recommends/git-basics/)