📄 Basic Git Command Cheat Sheet
Action Command Notes
Initialize Git in a git init Creates a .git folder.
folder
Check current git status
Shows changes and
status branch info.
Add all files to git add . . means "everything."
staging
Add one specific git add filename.js
file
Commit changes Always write meaningful
git commit -m "your commit message"
messages!
View commit Press q to quit log view.
history git log
Connect local repo git remote add origin
to GitHub https://github.com/yourrepo.git
Only needed once.
Push code to git push -u origin main
First time push. Later, just
GitHub git push .
Clone a repo
git clone Copies a repo to your
https://github.com/username/repo.git computer.
Pull latest git pull origin main Updates your local copy.
changes
Create a new git checkout -b feature-branch-name
-b means "create and
branch switch."
Switch branches git checkout branch-name
Merge a branch → git merge branch-name Always test before
into main git checkout main
merging!
Delete a branch After merging it.
locally git branch -d branch-name
See all branches Current branch is marked
git branch
with * .