Lesson

Git Intro

10 min reading
Free Course

Git Intro: Understanding Distributed Version Control

Git is a free, open-source distributed version control system that tracks changes to your files over time. Linus Torvalds created Git in 2005 to manage Linux kernel development, and Junio Hamano has maintained it since.

Every developer who clones a Git repository gets a complete local copy of the project history. You can commit, inspect old snapshots, and create branches offline without waiting for a central server.

Centralized vs Distributed Version Control

Older systems like Subversion store the full history on one central server. Git gives every contributor a local repository alongside shared remote hosting platforms like GitHub or GitLab.

flowchart LR
    subgraph Centralized ["Centralized VCS"]
        C1["Central Server"] <--> U1["Developer A"]
        C1 <--> U2["Developer B"]
    end

    subgraph Distributed ["Distributed VCS (Git)"]
        R1["Remote Repo"] <--> L1["Dev A Local Repo"]
        R1 <--> L2["Dev B Local Repo"]
    end

Core Git Terms You Need First

Before typing commands, learn these eight terms that appear in every Git workflow:

  • Repository: A project folder containing a hidden .git database that records all snapshots and branch pointers.
  • Clone: Downloading a full copy of a remote repository and its commit history to your machine.
  • Stage: Selecting modified files in the index so they are ready for the next snapshot.
  • Commit: Saving a permanent snapshot of staged files along with an author name, timestamp, and message.
  • Branch: An independent line of development that lets you build features without touching main.
  • Merge: Combining commits from one branch back into another branch.
  • Pull: Fetching new commits from a remote repository and updating your local branch.
  • Push: Uploading your local commits to a shared remote repository.

How a Typical Git Cycle Works

You start by initializing a repository or cloning an existing project. When you edit index.html or styles.css, Git detects those modifications in your working directory.

Next, you stage the specific changes you want to keep using git add. Running git commit records a permanent snapshot, and git push shares that snapshot with your team.

git status
git add index.html styles.css
git commit -m "Add initial header layout"

Common Mistakes Beginners Make

Many new developers treat Git like a backup zip folder and commit everything once a week. Huge commits make it hard to trace bugs or undo a single broken change.

Another common mistake is forgetting to run git status before committing. Always check which files are staged so temporary build artifacts or environment secrets never enter your commit history.

Frequently Asked Questions

Is Git the same thing as GitHub?

No. Git is the command-line tool that tracks file history on your computer, while GitHub is a cloud hosting service that stores Git repositories and adds pull requests, issue tracking, and team permissions.

Can I use Git without an internet connection?

Yes. Because Git is distributed, you can create commits, switch branches, inspect logs, and compare diffs locally. You only need internet access when pushing to or pulling from a remote server.

Does Git only work for programming code?

No. Git tracks any file format, though it works best with plain-text files such as HTML, CSS, JavaScript, PHP, Markdown, and configuration files where line-by-line diffs are readable.

Save Your Progress

Unlock Your
Full Potential.

Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.

Quick Access With

Enterprise-Grade Security Protocol
Git Topic Hub

Stuck on this lesson?

Join our community of senior developers.

Ask in Forum