Sitemap
Hema Kalyan Murapaka

Hema Kalyan Murapaka

A Data Scientist and Machine Learning Enthusiast

Git & GitHub: What is Git?

3 min readFeb 4, 2024

Welcome to the realm of Git, your indispensable companion in the world of coding collaboration. In this blog, we’ll demystify Git’s core concepts — from its unique snapshot approach to the three vital states your files can be in. By the end, you’ll wield the basics of Git with finesse, ready to enhance your coding workflow and contribute seamlessly to any project. Let’s dive into the heart of Git and unlock the keys to successful version control.

Press enter or click to view image in full size
Photo by Yancy Min on Unsplash

Git is a distributed version control system designed to facilitate collaboration and track changes in a project effectively. It serves as software for monitoring changes in any set of files and is primarily used for coordinating among the programmers developing source code during software development.

One notable difference between Git and remaining version control systems lies in how they store information. while other systems employ a list of file-based changes, known as delta-based version control, git deviates from this approach. Instead, it captures a snapshot of all files at the moment of each change in the project. If files remain unchanged, Git links to the previous identical file instead of storing it again.

Press enter or click to view image in full size

Git maintains its data integrity by generating an encrypted secure key called SHA-1 Hash with each operation done. The SHA (Simple Hashing algorithm) key is a 40-character string composed of hexadecimal characters (0–9 and a-f), such as 24b9da6552252987aa493b52f8696cd6d3b00373

Git has three main states that your files reside in: modified, staged, committed. Modified state implies that you have changed the file but haven't committed it to your database yet. Staged state implies a pre-committing area in which we are marking the modified file in its current version to get committed. Committed state implies that data is safely stored in your local database.

Get Hema Kalyan Murapaka’s stories in your inbox

Join Medium for free to get updates from this writer.

This leads us to the three main sections of a git project: working tree, staging area, and git directory.

Press enter or click to view image in full size

The working tree is a single checkout of one project version, while the staging area, also known as the “index,” stores information about the changes to be included in the next commit. The Git directory is where metadata and the object database for the project are stored.

The basic Git workflow involves modifying files in the working tree, selectively staging desired changes, and committing them to permanently store the snapshot in the Git directory. Understanding the distinctions between committed, staged, and modified states is crucial in navigating Git Basics, where you’ll gain further insights into leveraging these states effectively or skipping the staged part entirely.

Happy coding, and may your Git repositories always reflect the brilliance of your work! Keep it precise, keep it collaborative. Until next time, happy coding!

Connect:

--

--

Hema Kalyan Murapaka
Hema Kalyan Murapaka

Written by Hema Kalyan Murapaka

A Data Scientist and Machine Learning Enthusiast