How to Learn Git for DevOps: Beginners Git Roadmap

git for devops

As a DevOps engineer, learning core git concepts is very essential. In this blog, I will talk about git for devops and why git is an important skill for a DevOps engineer. I have also listed the relevant resources to learn Git the right way.

What is Git?

Git is an open-source distributed version control system. It is very lightweight and works on almost all operating systems.

In 2005, Linus Torvalds created git as a distributed version control system when the Linux kernel development team couldn’t use BitKeeper for free anymore.

Now, git is the de facto version control system used by developers all over the world. Its distributed nature makes it easy to develop, track and collaborate well with code changes.

The StackOverflow Developer survey results shown below show that 93% of engineers use Git and it is a fundamental tool for them.

percentage of engineers using Git as a fundamental developer tool.

When we say git, most of the new learners today refer to Github.

Platforms like GitHub or Bitbucket are built on top of git with additional functionalities that help engineers and organizations to host and version control the code in the remote Git repository. Also, it comes with good integrations to work with other open-source CI/CD tools.

With GitHub Actions, you can set up the whole CI/CD pipeline using the GitHub and Gitlab platforms themselves. It eliminates the need for managing multiple tools for CI/CD.

Git for Devops

Let’s look at the key factors of why Git is needed for DevOps.

1. To Have Meaningful CI/CD Discussions with Developers

One of the tasks of a DevOps engineer is to design and develop CI/CD pipelines. Git plays a key role in CI/CD. From my experience working in different companies, I can say, there is no single standard for git branching and workflows. Sometimes, you need to sit with the developers and discuss the right approach for git branching in the CI/CD pipeline. This includes git tagging, release versioning, etc.

In fact, in most organizations, DevOps engineers own and operate the git repositories.

So, to have a meaningful discussion with development teams, you should have good knowledge of Git.

2. For Infrastructure as Code

Also, when we talk about infrastructure as code, we develop and maintain all the infrastructure code in Git. Be it a Jenkins pipeline, Ansible playbook, or a Terraform module.

We treat infra code the same way application code is treated. Meaning, infra code goes through the same unit testing and integration tests before getting deployed to any environment.

It means, even the infrastructure code needs to have a CI/CD pipeline. That again translates to git-based workflows.

Most companies do not follow test-driven development for infra code, but it is the standard way of developing infrastructure code.

3. Gitops

With technical practices like GitOps, git acts as a source of truth for all the infrastructure configurations.

With Gitops, any change in git repo configs gets deployed in the infrastructure.

So it is a must for DevOps engineers to know all about git.

Also, tools like ArgoCD have the whole workflows around gitOps practice.

Git Learning Roadmap

Here is the roadmap on how you can learn git.

TopicResource
Understand Version Control SystemWhat is a version control system
Understand Distributed Version ControlWhat is distributed Version Control
Git InstallationOfficial Git Website Downloads
GUI ClientsGit GUI Clients
Git basicsGit basics Videos
Fundamental of GitGuided git tutorial
Advanced GitAtlassian Advanced Git Tutorial

What are the Best Resources to Learn Git?

If you are looking for guided courses to learn git, I have picked the following best resources to learn git the right way.

  1. A Guide to Git & Version Control [educative interactive course]
  2. Version Control with Git [Free Udacity Course]
  3. Git Complete: The definitive, step-by-step guide to Git [Udemy]
  4. Version Control with Git [Free Udacity Course]

Git DevOps Interview Questions

When it comes to DevOps interview questions, it’s more about practical scenarios. So most of the Git devops interview questions will be based on real-time scenarios of the particular project you are getting interviewed for.

You can learn about the generic git functionalities using the resources I mentioned above. You should be able to answer all the generic git questions.

However, if you don’t have experience in working with git in real-time projects, I have a solution for you.

Go to Stackoverflow git tag, and browse for specific git topics. For example git rebase. It should bring up many real-time scenarios and issues people are facing as shown in the image below.

Learning real-time git scenarios.

You will get a lot of information that can help you in the interviews.

Another place you can look for is, Reddit Git. Here also you can find many conversations on git that will be helpful for learning and interviews.

Following are the important git concepts you should learn for DevOps interviews

Basic Git ConceptsOther Concepts
1. Branching
2. Merging
3. Commits
4. Git Tagging
5. Pull Requests
6. Gitignore
7. Git Web Hooks
8. Forks
9. detached HEAD
10. Checkout a specific commit
11. Large File Handling
12. Managing Secrets and Sensitive Information
13. Remote Branches and Collaboration
1. Rebasing
2. Cherry Picking
3. Squashing
4. Stashing
Undetstand The DifferencesFor CI/CD
1. Git Vs Github
2. git merge Vs git rebase
3. git pull vs fetch
4. git revert vs reset
5. Stashing and Checkouts
6. Submodules and Subtrees

Git Workflows
Trunk based development
Feature Driven Development

Conclusion

Git is a simple version control system, but there are powerful tools around git for DevOps automation.

Once you learn the basics, it is better to create your code repositories and try out all the git advanced features. To retain the knowledge, you can document all the git functionalities you learned in a git repository.

Also, if you want to learn Linux, check out my guide on how to learn Linux shell scripting.

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like