Please enable JavaScript to view the comments powered by Disqus. Git! An Important DevOps Tool

 

 

 

 

Git! An Important DevOps Tool

NovelVista
NovelVista

Last updated 27/07/2021


Git! An Important DevOps Tool

Git is one of the most popular DevOps tools, widely used across the software industry. It’s a distributed SCM (source code management) tool, loved by remote teams and open source contributors. Git allows you to track the progress of your development work. You can save different versions of your source code and return to a previous version when necessary. It’s also great for experimenting, as you can create separate branches and merge new features only when they’re ready to go.

Let me put it this way- Git is a place where you can:

  • Store your source code
  • Track changes in your source code
  • Anybody can access the source code if needed.

Why is it so important?

If you are a coder/ programmer/ developer, you have to know Git.

  • Most importantly, your code is saved for life. You can't lose it.
  • Suppose, you and your friend are working on a project/software and want to make some modifications, how would you do so?

Git allows developers to download a new version of the software/project/code/file, make changes, and upload the newest revision.

  • You can track every change in the source code and check how it looked 1 day, 1 month, 1 year, or 10 years before.
  • You can look for people working on similar projects and work with them.
  • Contributing to an open-source is such great exposure to one. It makes you future-ready for the Tech industry.

Git key concepts

Git key terminologies include:

  • Version Control System: Git helps maintain various versions of the codebase at different stages of the development lifecycle. It is also called a source code manager.
  • Commit: When a developer makes code changes, the changes are saved in the local repository. Every commit saves a copy of the changed/added files within Git.
  • Push - This sends the recent commits from developers' local repository to a remote server like GitHub, GitLab, or BitBucket.
  • Pull - This downloads any changes made from the remote Git repository and merges them into the developers' local repository.
  • SHA (Secure Hash Algorithm): This is a unique ID given to each commit.
  • Branch: When you diverge from the mainline of software development and continue to work/code without messing with the main/master development line.

Role of GIT in DevOps

The DevOps approach needs a version control system that will track all the changes. Git is a distributed version control system that allows developers to keep a local copy of the commits they make. GIT as a DevOps tool empowers collaboration and faster release cycles, and that is what the DevOps concept is based upon.

Version control is one of the best practices of DevOps. With version control, developers working on a project can version the software, share, collaborate, merge, and have backups.

When working in large organizations, where multiple teams work together on the same project, Git comes in handy and makes it easy to track changes made by each team. It helps in tracking code, version control, and effective management of code.

Anyone willing to start or approach DevOps as a career should start from the basics, and GIT is the fundamental tool that overrides everything else.

Most popular Git solutions

Every company is now powered by software in one or the other ways. There are multiple projects handled by many developers in an organization, and they all need the means to track, upload, and receive changes to the code base. Effective repository management services are the key to fast and efficient software development. The most popular ones based on Git are GitHub, Bitbucket, and GitLab.

GitHub is a git-based repository host launched initially in 2008 by PJ Hyatt, Tom Preston-Werner, and Chris Wanstrath. As of now, GitHub is the largest repository hosting platform with more than 38 million projects. It authorizes to host and review code, manage projects, and build software.

Bitbucket was also launched in 2008 by an Australian startup and it initially supported only for Mercurial projects. In 2010 Bitbucket was smartly bought by Atlassian, and from the next year, it started supporting Git hosting, which is now its primary focus. Bitbucket has become a household name and provides free unlimited private repos, many powerful integrations like Jira and Trello, and has built-in continuous delivery.

GitLab started as a small project in 2011, aiming to provide an alternative to the available repository management solutions. The company was only incorporated in 2014. Gitlab now provides a complete DevOps setup for the organizations from continuous integration and delivery, agile development, security, etc.
Comparing Confusing Terms in GitHub, Bitbucket, and GitLab | GitLab

Difference between Git and GitHub

One of the most common questions everybody asks is the difference between Git and Github. Git is the tool/technology that allows versioning of code and Github is the centrally hosted Git server where the Git repository lives. Developers use the remote repository hosted on Github to share their work among themselves. Github is just one of the many tools such as Gitlab, BitBucket, etc.

Commands

To get started with Git you must have it on your computer. If you don’t already have it you can go to the git website and follow the instructions.

Initialize a new Git repository: Git init

Everything you code is tracked in the repository. To initialize a git repository, use this command while inside the project folder. This will create a .git folder.

git init

Git add

This command adds one or all changed files to the staging area.

To just add a specific file to staging:

git add filename.py

To stage new, modified, or deleted files:

git add -A

To stage new and modified files:

git add.

To stage modified and deleted files:

git add -u

Git commit

This command records the file in the version history. The -m means that a commit message follows. This message is a custom one and you should use it to let your colleagues or your future self know what was added in that commit.

git commit -m "your text"

Git status

This command will list files in green or red colors. Green files have been added to the stage but are not committed yet. Files marked as red are the ones not yet added to the stage.

git status

Working with branches

Git branch branch_name

This will create a new branch:

git branch branch_name

Git checkout branch_name

To switch from one branch to another:

git checkout branch_name

Git checkout -b branch_name

To create a new branch and switch to it automatically:

git checkout -b branch_name

This is short for:

git branch branch_name

git checkout branch_name

Git branch

To list all the branches and see on what branch you currently are:

git branch

Git log

This command will list the version history for the current branch:

git log

 

Push & Pull

Git push

This command sends the committed changes to a remote repository:

git push

Git pull

To pull the changes from the remote server to your local computer:

git pull

A few myths about Git

Myth 1: Git is only for Software Developers

Git is not just for developers. Git is for anyone working in IT - from Systems Administrators to Solutions Architects, Software Engineers, Team Leads, Project managers - should equally learn and understand the workflows in Git.

With the advent of Infrastructure as Code, System administrators and operations teams will be using Git to store code related to infrastructure such as Terraform Configuration files, Ansible Playbooks, Vagrant files, supporting shell scripts.

Myth 2: GitHub is just a codebase/repository

Git is not just a code repository. Git is where new software is developed. Today most of the popular projects are developed on Github - Kubernetes, Ansible, Terraform, Tensorflow, Helm Charts being a few of the top repositories. All of these projects have extensive documentation built on Github. The Git workflow was built with a collaboration between developers in mind. Code reviews and approvals happen on Github. Github has a Project dashboard that enables project management.

Conclusion

I hope this blog helped you understand Git. You have learned all about Git, you learned various essential topics, like version control systems, centralized version control systems, distributed version control systems, what exactly Git is, benefits of Git, Git workflow, branch in Git, commands in Git, and finally, we busted a few myths on about DevOps.

 

Topic Related Post
DevOps Trends in 2024: The Continued Rise of GitOps, Data Observability, and Security
Building a High-Performing SRE Team: Key Strategies and Best Practices
Securing the Pipeline: Integrating Security into Your SRE Practices

About Author

NovelVista Learning Solutions is a professionally managed training organization with specialization in certification courses. The core management team consists of highly qualified professionals with vast industry experience. NovelVista is an Accredited Training Organization (ATO) to conduct all levels of ITIL Courses. We also conduct training on DevOps, AWS Solution Architect associate, Prince2, MSP, CSM, Cloud Computing, Apache Hadoop, Six Sigma, ISO 20000/27000 & Agile Methodologies.

Tags

 
 
SUBMIT ENQUIRY

* Your personal details are for internal use only and will remain confidential.

 
 
 
 
 
 
Upcoming Events
ITIL-Logo-BL ITIL

Every Weekend

AWS-Logo-BL AWS

Every Weekend

Dev-Ops-Logo-BL DevOps

Every Weekend

Prince2-Logo-BL PRINCE2

Every Weekend

Topic Related
Take Simple Quiz and Get Discount Upto 50%
Popular Certifications
AWS Solution Architect Associates
SIAM Professional Training & Certification
ITIL® 4 Foundation Certification
DevOps Foundation By DOI
Certified DevOps Developer
PRINCE2® Foundation & Practitioner
ITIL® 4 Managing Professional Course
Certified DevOps Engineer
DevOps Practitioner + Agile Scrum Master
ISO Lead Auditor Combo Certification
Microsoft Azure Administrator AZ-104
Digital Transformation Officer
Certified Full Stack Data Scientist
Microsoft Azure DevOps Engineer
OCM Foundation
SRE Practitioner
Professional Scrum Product Owner II (PSPO II) Certification
Certified Associate in Project Management (CAPM)
Practitioner Certified In Business Analysis
Certified Blockchain Professional Program
Certified Cyber Security Foundation
Post Graduate Program in Project Management
Certified Data Science Professional
Certified PMO Professional
AWS Certified Cloud Practitioner (CLF-C01)
Certified Scrum Product Owners
Professional Scrum Product Owner-II
Professional Scrum Product Owner (PSPO) Training-I
GSDC Agile Scrum Master
ITIL® 4 Certification Scheme
Agile Project Management
FinOps Certified Practitioner certification
ITSM Foundation: ISO/IEC 20000:2011
Certified Design Thinking Professional
Certified Data Science Professional Certification
Generative AI Certification
Generative AI in Software Development
Generative AI in Business
Generative AI in Cybersecurity
Generative AI for HR and L&D
Generative AI in Finance and Banking
Generative AI in Marketing
Generative AI in Retail
Generative AI in Risk & Compliance
ISO 27001 Certification & Training in the Philippines
Generative AI in Project Management
Prompt Engineering Certification
Devsecops Practitioner Certification
AIOPS Foundation Certification
ISO 9001:2015 Lead Auditor Training and Certification
ITIL4 Specialist Monitor Support and Fulfil Certification
Generative AI webinar
Leadership Excellence Webinar
Certificate Of Global Leadership Excellence
ISO 27701 Lead Auditor Certification
Gen AI for Project Management Webinar
Certified Cloud Tester Foundation
HR Business Partner Certification
Chief Learning Officer Certification
Gen AI in Cybersecurity Webinar
Six Sigma Webinar
Gen AI Powered ITSM Webinar
PM Prince2 PMP Webinar
Certified Generative AI Expert
GCP Professional Cloud Architect
GitHub Copilot Training Program
Certified Service Desk Professional
Certified Generative AI in ITSM
Recruitment & Sourcing