Skip to main content

What is Git and GitHub. Difference Between Git and GitHub. Workflow of Git.

Introduction

In this blog, we will dive into a Git and GitHub, understand their differences, and go over the typical workflow when using GitHub. Whether you are new to version control or simply curious about how these tools work together, this guide will walk you through the essential concepts and processes you need to know.

What is Git?

Git is a Distributed Version Control System (DVCS) that efficiently manages code changes across multiple contributors. It helps developers to monitor and manage changes in their code efficiently. Git was created by Linus Torvalds on April 7, 2005. It is widely used in developer community for its collaborative features, allowing developers to work on the same project, whether the project is small or large. You can efficiently monitor code modifications and preserve a detailed history of changes.

Git is free and open-source, designed to handle everything from individual projects to complex ones. Developers can track every modification, create branches for different features, and merge changes back into the main project, all while maintaining a complete history of the project's progress.

What is Github?

GitHub is a cloud-based service designed for hosting and managing Git repositories. It enables developers to save, organize, and monitor code modifications. Besides version control, GitHub offers collaboration tools like bug tracking, task management, and pull requests, making it ideal for team-based projects.

On GitHub, users can share their repositories online, allowing others to copy (or clone) them for development on their local machines, Whether for public or private repositories, GitHub makes it easy for individuals and teams to collaborate.

Workflow of Git


The Git workflow is a sequence of steps developers follow to track, modify, and manage their code. Here's a typical GitHub workflow:

1. Clone the repository - Start by cloning the project from the remote GitHub repository to your local machine.

2. Create a new branch or modify files - Either create a new branch to work on specific features or modify files directly in the existing branch.

3. Stage your changes - After making modifications, add them to the staging area, which indicates that the changes are ready for commit.

4. Commit your changes - Once the changes are staged, save them to your local repository with a descriptive message explaining the modifications.

5. Merge branches - ensure that any necessary changes are integrated into the main branch by merging it within your local repository.

6. Push changes - Upload your latest updates from the local repository to the remote GitHub repository, making them accessible to others.

Difference Between Git and GitHub

Here's how Git and GitHub differ based on their type, function, purpose, working, and creation:

Criteria

Git

GitHub

Type

A distributed version control system

A web-based platform for hosting Git repositories

Function

Tracks and manages code changes locally

Provides a cloud-based platform for storing and sharing repositories

Purpose

Helps manage code versions, branches, and history

Used for tracking issue, collaboration, code hosting, and allow developers to share projects.

Working

Operates locally on your machine without needing internet access

Allows access to repositories from anywhere through the web

Creation

Developed by Linus Torvalds in 2005

Developed by Tom Preston-Werner, Chris Wanstrath, and PJ Hyett in 2008


Glossary

Repository: A repository functions similarly to a folder on your computer, but it has special capabilities for tracking and managing changes to code or files. When a repository (often referred to as a "repo") is created on GitHub, it is hosted in the cloud, allowing you to store, access, and collaborate on projects from anywhere. Beyond file storage, it maintains a complete history of all changes, making it an essential tool for version control and team collaboration.

Staging Area: Before committing changes to your project, you first need to add those change to the staging area so Git can track them. This staging area serves as a bridge between your working directory and the commit history, allowing you to review and organize modifications before finalizing them. It helps track specific changes that are prepared for a commit. Without adding files to this staging area, you cannot commit them, meaning the changes won’t be saved in the project’s official history.

Commit: When you edit or modify code, Git tracks changes, but for them to be permanently recorded in the project's history, you must commit them. Before committing, make sure your changes are stagged. This step lets you determine which modifications will be included in the commit. Once in the staging area, the changes can be committed with a descriptive message, documenting the updates.

Conclusion

In conclusion, we understood Git and GitHub and its purpose. Git in commonly used for version control to track changes and GitHub is used for code hosting for collaboration and code sharing. Both work together to enhance workflow efficiency. We also explored Git's workflow and discussed key terms such as repository, staging area, and commit, gaining a clearer understanding of their roles in version control.

Comments

Popular posts from this blog

Leetcode SQL 50 interview questions with solution: A Guide for Coders

Introduction Hi coders, In this blog, we will tackle SQL questions from LeetCode. If you're a coder, a computer science student, or simply interested in coding, you may be familiar with LeetCode. It's a platform where coding enthusiasts practice problems to enhance their critical thinking and problem-solving skills. Most of us practice programming questions on leetcode so here we practice SQL questions which is taken from leetcode. We'll start with basic SQL questions focused on SELECT , joins, and aggregate functions. Once we've covered these foundational topics, we'll transition to more advanced concepts. Before diving into the questions, ensure you have a basic understanding of SQL syntax and statements, including SELECT , various joins (self join, left join, right join, outer join), and basic aggregate functions. Here are some SQL interview questions with solution: Q1 1757. Recyclable and Low Fat Products SELECT product_id FROM Products WHERE low_fats ...

How to Create a Responsive Website Using CSS - A Step-by-Step Guide.

Introduction Creating a responsive website is not an option, It's number one priority for a developer to make a website responsive. A responsive website adjusts according to different screen sizes, providing an optimal user experience on desktops, tablets, and mobile devices. For creating a responsive website, You don't need JavaScript to make your website responsive, HTML and CSS are enough. In this guide, we will walk through the key techniques to build a fully responsive web page from scratch. Why is Responsiveness Important? A responsive website offers several benefits, including: Better User Experience - Ensures your content is readable on all devices. Improved SEO Ranking - Mobile-friendly websites rank higher in search results. Faster Loading Times - Optimized layouts prevent unnecessary resource consumption. Increased Engagement - Users stay longer on a site that adapts well to their screen. Now, let's dive into the essential techniques to create a responsive we...