A simple Git routine keeps your history clean and makes it easier to collaborate, review changes, and recover work when something goes wrong.
Core commands
`git status`
Checks what changed in the working directory and what is ready to be staged.
git status
`git add`
Moves files into the staging area so they can be included in the next commit.
git add .
`git commit`
Saves your staged changes as one clear snapshot with a message.
git commit -m "Describe the change"
`git push`
Sends your local commits to GitHub so the remote repo stays updated.
git push origin main
`git pull`
Downloads the latest changes from GitHub and merges them into your local branch.
git pull origin main
`git branch`
Shows your branches or creates one for isolated work.
git branch
git branch feature-name
`git log`
Displays the commit history when you want to review what was changed.
git log --oneline
`git diff`
Highlights the actual line-by-line edits before you commit them.
git diff
Typical workflow
git status
git diff
git add .
git commit -m "Update dashboard layout"
git push origin main
Tips for interviews
- Use `git status` before every commit so you know exactly what is changing
- Write commit messages that describe the reason, not only the file name
- Pull before you push if you are working with a shared repository
- Use branches when you want to test ideas without touching the main line