Local = On your PC
Remote = On a server (GitHub)
Simple analogy: Local = draft, Remote = shared final version.
1. MODIFY your files
↓
2. git ADD (stage)
↓
3. git COMMIT (save locally)
↓
4. git PUSH (send to remote)Visual:
Working Directory → Staging Area → Local Repo → Remote Repo
edit add commit push| Command | Action |
|---|---|
git status | See the state of the files |
git add . | Stage all changes |
git commit -m "message" | Commit with a message |
git push | Send to remote |
git pull | Retrieve from remote |
| Command | Action |
|---|---|
git init | Initialize a local repo |
git clone <url> | Copy a remote repo |
git remote add origin <url> | Connect to the remote |
| Command | Action |
|---|---|
git log --oneline | Concise history |
git diff | See the changes |
git branch | List the branches |
git pull origin main # Synchronize with the team# Modify your files...
git status # See what changed
git add . # Stage all changes
git commit -m "Add new feature" # Commitgit push origin main # Send your commitsgit add . && git commit -m "Quick update" && git pushgit stash # Save work in progress
# Urgent fix...
git stash pop # Recover your workThat's all! Master these commands = 90% of your daily Git usage.