You write code. You break code. You fix code.
But do you track your code like a pro?

Whether you're solo-building or deep in team chaos, Git isn’t just a tool — it’s your version control superpower.

🧠What is Version Control?

Version Control is a system that tracks and manages changes to your codebase over time, enabling multiple people to collaborate, revert mistakes, and maintain a history.

🔍Why Use Version Control?

  • Tracks every change: Maintains the history of who edited what, when.
  • Enables collaboration: Multiple developers can work simultaneously without overwriting the team’s code.
  • Provides backups: Revert to previous versions if something breaks.

🛠️Types of Version Control Systems

Centralized (e.g., SVN): Single central repository.

Distributed (e.g., Git): Every user has a full copy of the repository.

Git is a distributed version control system known for its speed, flexibility, and popularity in modern software development.

⚙️ Git vs GitHub: Know the Difference

Git

GitHub

Version control tool (installed locally)

Online hosting service for Git repositories

Works offline

Requires internet to push/pull

You track changes locally

You share code and collaborate with others

 

 

🧰 Basic Git Workflow: Your First Version Control Flow

  1. Initialize a repo

git init

  1. Check file status

git status

  1. Track a file

git add filename

git add .

  1. Commit changes

git commit -m "Add login page"

  1. Connect to GitHub

git remote add origin <repo-url>

git push -u origin main

What is GitHub?

GitHub is a platform for hosting Git repositories, collaborating with teams, and managing projects. It adds features like pull requests, issues, and CI/CD integration.

🌐 GitHub Basics: Working with Remotes

Action

Command

Clone a repo

git clone <url>

Push changes

git push origin branch-name

Pull updates

git pull origin branch-name

Create branch

git checkout -b feature-x

Switch branch

git checkout branch-name

 

💡Collaborating with GitHub

Branching

Branches allow parallel development without affecting the main codebase.

  • Create a branch:

git branch feature-branch

git checkout feature-branch

·       Push branch to GitHub:

git push origin feature-branch

🔄Pull Requests (PRs)

PRs let you propose and review changes before merging.

  1. On GitHub, create a PR from feature-branch to main.
  2. Add reviewers, discuss changes, and merge when approved.

Forking and Contributing

  • Fork: Copy a repository to your GitHub account.
  • Clone, make changes, and submit a PR to the original repository.

Tip: Always pull the latest changes before starting work:

- git pull origin main