git status |
See which files are staged, unstaged, or untracked |
Check file status |
git diff |
See what’s changed but not yet staged |
View unstaged changes |
git add filename |
Add a specific file to the staging area |
Stage a specific file |
git add . |
Add everything in the directory |
Stage all changes |
git commit -m "Message here" |
Save your staged changes with a message |
Commit staged changes |
git push |
Upload your commits to the remote repository |
Push commits to GitHub |
git pull |
Fetch and merge the latest changes from GitHub |
Pull the latest changes |
git branch |
Show which branch you’re on |
Check current branch |
git checkout branch-name |
Move to another branch |
Switch branches |
git checkout -b new-branch-name |
Make a new branch and switch to it |
Create and switch to a new branch |