Skip to content

Instantly share code, notes, and snippets.

@benjiwheeler
Created October 31, 2025 17:27
Show Gist options
  • Select an option

  • Save benjiwheeler/da696da2cc72f32aaab8e9ded5df227e to your computer and use it in GitHub Desktop.

Select an option

Save benjiwheeler/da696da2cc72f32aaab8e9ded5df227e to your computer and use it in GitHub Desktop.
Git intro cheatsheet

🧰 Git Basics Cheat Sheet

Topic Purpose Command / Action Notes
Install Git Install Git on your computer macOS: brew install git
Ubuntu/Debian: sudo apt update && sudo apt install git
Windows: git-scm.com/downloads
Windows users should install Git Bash
Configure user info Set your name and email for commits git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Run once per computer; use git config --list to verify
Authenticate with GitHub Enable push/pull access SSH method:
ssh-keygen -t ed25519 -C "[email protected]"
cat ~/.ssh/id_ed25519.pub → add key on GitHub → Settings → SSH Keys
SSH is recommended for long-term setup
Start a repo Create a Git repository in a folder git init Creates a hidden .git folder
Add files Track all files in the directory git add . Use git status to verify added files
Commit changes Save a snapshot of your work git commit -m "Initial commit" Always include a short, meaningful message
Connect to GitHub Link local repo to remote repo git remote add origin [email protected]:username/repo.git Connects local and remote repos
Push to GitHub Upload commits to GitHub git branch -M main
git push -u origin main
Sets “main” as default branch
Pull updates Get latest changes from GitHub git pull Keeps local copy up to date
Check status See what’s new or changed locally git status Shows new, modified, and tracked files
View history See previous commits git log Add --oneline for a compact view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment