Skip to main content

Command Palette

Search for a command to run...

Getting started with Git and GitHub

beginner to intermediate in no time.

Updated
5 min read
Getting started with Git and GitHub

.introduction

Navigating the world of software development without Git and GitHub is like trying to build a house without tools. These platforms are essential for managing code, collaborating with teams, and building reliable software.

In this guide, we’ll break down Git and GitHub in the simplest way possible. Whether you're just starting your coding journey or looking to strengthen your fundamentals, this article will help you move from beginner to confident user.

By the end of this article, you will understand:

  • What Git is and why it matters

  • How Git works in real-world projects

  • What GitHub does

  • Basic Git commands and workflow

  • How everything connects together

.explaining Jargons (with a simple example)

Making technical terms easy so nothing feels overwhelming 🙂GitHub, Repositories, and Git: A Library Analogy

GitHub → The Library

Think of GitHub as a massive digital library. It’s a platform where countless “books” (repositories) are stored and organized. Just like a physical library, GitHub allows people to find, share, and collaborate on projects.

Repository → The Book

A repository (or repo) is like a single book in that library. It contains all the files and information related to one specific project.

For example:

  • A novel → A web application

  • A cookbook → A collection of scripts

  • A journal → Personal practice projects

Everything related to that project lives inside the repository.

Git → The Librarian

Git is the librarian of this digital library.

It tracks every change made to the book (repository) over time. Just like a librarian records every edition of a book, Git keeps a complete history of modifications.

This allows you to:

  • Revert to previous versions – If you make a mistake, you can go back.

  • Compare changes – See exactly what changed between versions.

  • Collaborate smoothly – Multiple people can work on the same project, and Git merges changes properly.

In Simple Words

  • GitHub → Where your project lives online

  • Repository → Your project folder

  • Git → The tool that tracks changes

.what is Git?

Git is a free and opensource distributed version control system that tracks changes in your codebase.

But what is a Version Control System (VCS)?

Imagine you’re working on a group project. A new feature needs to be added or a bug needs to be fixed. Without version control, managing code changes becomes messy and confusing.

Git solves this problem.

With Git, you can:

  • Create branches for new features without disturbing the main code.

  • Track when and where a bug was introduced.

  • Revert to earlier working versions.

  • Collaborate without overwriting others’ work.

Why Git is Powerful

  • Revert to previous versions

  • Experiment freely using branches

  • Collaborate effectively

  • Maintain a complete history of changes

Understanding Branching (Very Important)

Branches allow you to work on features independently.

Example:

main: A ---- B ---- C
feature: D ---- E

Here:

  • main is your stable code.

  • feature is where you experiment.

  • Once finished, you merge it back into main.

This is how real-world development works.

.basic Git Commands

Here are the most important Git commands:

  • git init → Initialize a new Git repository

  • git add → Add files to the staging area

  • git commit → Save changes with a message

  • git push → Upload changes to GitHub

  • git pull → Download latest changes from GitHub

  • git clone → Copy a repository from GitHub

  • git branch → Create or manage branches

  • git merge → Merge one branch into another

Git Cheat Sheet: https://education.github.com/git-cheat-sheet-education.pdf

Your First Git Workflow (Step-by-Step)

Step 1: Create a Project

mkdir my-project
cd my-project
git init

Step 2: Add a File

touch index.html
git add .
git commit -m "Initial commit"

Step 3: Connect to GitHub

Create a new repository on GitHub, then run:

git branch -M main
git remote add origin https://github.com/yourusername/my-project.git
git push -u origin main

Your project is now live on GitHub!

.getting Started (Git Configuration)

Before using Git, configure your identity:

git config --global user.name "John Doe"
git config --global user.email "johndoe@email.com"

Set Visual Studio Code as default editor:

git config --global core.editor "code --wait"

Check configuration:

git config --global --list

.what is GitHub?

GitHub is a cloud-based platform where you host Git repositories.

It’s often described as a social network for developers because it allows you to:

  • Share your projects

  • Contribute to open-source

  • Review code

  • Track issues

  • Collaborate with teams

GitHub is owned by Microsoft and offers generous free plans for individuals and open-source projects.

Key Features of GitHub

  • Code Hosting – Store repositories in the cloud

  • Pull Requests – Review and merge code

  • Issues – Track bugs and features

  • Actions – Automate workflows (CI/CD)

  • Open Source Collaboration

Clone vs Fork vs Pull Request

Clone

git clone copies a repository from GitHub to your local machine.

Fork

Fork creates a copy of someone else’s repository under your GitHub account.

Pull Request (PR)

A Pull Request is a request to merge your changes into another repository. It is commonly used in open-source contributions.

Mastering Git and GitHub early will significantly improve your workflow and set you apart as a developer.

  • Official Git Documentation

  • GitHub Docs

170 views
S

🔥

Y

Complete structured walk through of the topic. Loved it

2
S

Thanks