From Code to Performance

Git vs. GitHub

Git is a distributed version control system (DVCS). It’s a tool you install and run locally on your computer.

Key features:

  1. Snapshots, Not Diffs:
    • Git doesn’t just save file differences (like older systems).
    • Instead, every commit is a snapshot of your entire project at that moment in time.
    • This makes rollbacks or branching faster and safer.
  1. Branching and Merging:
    • Branches in Git are lightweight and easy to create.
    • Branches can be merged back into the main codebase when ready.
    • Developers can branch off, test ideas, then merge successful work into the main line.

Example:

git checkout -b new-feature # Work on new feature
git commit -m "Added new feature"
git checkout main
git merge new-feature
  1. Distributed by Design:
    • Unlike centralized systems (like SVN), Git allows every developer to have a full copy of the repository (with history).
    • This means: You don’t need internet access to commit and you're less dependent on a single server


Analogy: Git vs GitHub

Imagine your are writing a novel:

  • Git is like Microsoft Word with track changes:
  • GitHub is like Google Docs:
  • Summary:

    Git Without GitHub

    You can use Git entirely on your local machine without ever touching GitHub. For example:

    git init                             # Initialize a new Git repository
    git add .                            # Stage all changes for commit
    git commit -m "Initial commit"       # Commit changes with a Message
    git branch feature-branch            # Create a new branch
    git checkout feature-branch          # Switch to the new branch
    git merge feature-branch             # Merge changes back to main branch
    git log                              # View commit history
    

    This creates a local repository - no internet needed.

    You can also set up your own Git server using alternatives like:



    GitHub Without Git (Limited Use)

    Technically, you can use Github's web interface to:

    But without Git, you lose the power of:

    Bottom Line: