Back to Blog
GitTutorial

Getting Started with Git and GitHub

Computer ClubJan 15, 20265 min read

Why Version Control Matters

If you've ever worked on a project and ended up with files named final.docx, final_v2.docx, final_REAL_final.docx, you already understand the problem that version control solves.

Git is a version control system that tracks every change you make to your code. GitHub is a platform that hosts your Git repositories online, making it easy to collaborate with others.

Setting Up Git

First, install Git from git-scm.com. Then configure it with your name and email:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

Your First Repository

Create a new folder for your project and initialize Git:

mkdir my-project
cd my-project
git init

Now create a file, add it, and make your first commit:

echo "# My Project" > README.md
git add README.md
git commit -m "Initial commit"

Connecting to GitHub

  1. Create a new repository on github.com
  2. Copy the repository URL
  3. Connect your local repo:
git remote add origin https://github.com/username/my-project.git
git push -u origin main

Key Commands to Remember

CommandWhat It Does
git statusSee what's changed
git add .Stage all changes
git commit -m "message"Save a snapshot
git pushUpload to GitHub
git pullDownload latest changes
git branch featureCreate a new branch
git checkout featureSwitch to a branch

Next Steps

Once you're comfortable with the basics, explore branching, pull requests, and collaborative workflows. Check out Learn Git Branching for an interactive tutorial.

Happy coding!