Basic & Common Git Commands – Easy to Revise
| Command | What It Does |
|---|---|
git init |
Initialize a new Git repository (only once) |
git status |
Check changed or new files |
git add . |
Add all files to staging area |
git commit -m "message" |
Save changes with a commit message |
git remote add origin <url> |
Connect local repo to GitHub |
git branch -M main |
Rename branch to main |
git push -u origin main |
Push code to GitHub |
git pull |
Fetch latest updates |
git log |
View commit history |