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.

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.

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.

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.

  1. Git branching strategies
  2. Git workflows
  3. Trunk based development
  4. Git Cherry Picking
  5. Significance of git Rebase
  6. git merge Vs git rebase
  7. git pull vs fetch
  8. git revert vs reset
  9. git stash
  10. Git tagging
  11. Checkout a specific commit
  12. detached HEAD

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.

22 Shares:
Leave a Reply

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

You May Also Like