Yeswanth Madasu

Day 02/13 of Git 101 Series.

Git vs GitHub and Installation

Concept

• Git = distributed version control system

• GitHub = remote hosting + collaboration layer (UI + services)

• Git works offline; GitHub always requires the network

• Your actual repository is the .git directory; GitHub is just a remote mirror

• Local commits exist even if GitHub is down, there's no link between both without our consent.


Internals

• Remotes are stored in .git/config as named URLs (origin by default)

• Remote-tracking branches live inside .git/refs/remotes/origin

• push uploads only missing objects, not the whole repo

• pull = fetch + merge (two operations)

• fetch updates remote-tracking refs but never touches your working tree


Commands

Installation (Linux/macOS/Windows):

Linux:

sudo apt install git

or

sudo dnf install git

macOS:

brew install git

Windows: Install Git for Windows (.exe installer)

Verify:

git –version

Remote commands:

git remote -v

git remote add origin 

git fetch origin

git push -u origin main

git pull –ff-only

git ls-remote origin

Example (Technical)

A backend REST API project hosted on GitHub:

this example shows Git (local) and GitHub (remote) interacting in one clean sequence.


Real-World Use Case

A development team syncing work across multiple machines:

• Developers push feature branches to GitHub • CI pipelines run on GitHub whenever new commits arrive • Team members fetch and rebase onto main to stay updated • Releases are created by tagging commits on GitHub • Code reviews happen on PRs before merging

this is the real reason GitHub is so good: collaboration flows.


Under the Hood

• Git pushes only the objects your remote doesn’t have • Fetch downloads new objects and updates .git/refs/remotes/origin/ • Remote-tracking branches are read-only snapshots of GitHub’s state • GitHub doesn’t modify your local files; it only updates server-side refs • Pull requests are server-side diffs: origin/feature-x vs origin/main


you can read the series of @blogs in here. and i do write a lot in twitter @yswnth

Tomorrow : Day 02/13 of Git 101 Series : Working Tree, Index, Commit.