Mohammad Khalooei Academy / Git
← Back to Academy

Git — Practical Commands

Research & team workflow cheat sheet

Daily workflow

git status git add -p git commit -m "Describe change clearly" git push origin feature/my-topic
git pull --rebase origin main git switch -c feature/new-experiment

History & inspection

git log --oneline --graph --decorate -n 20 git show HEAD git diff main...HEAD
git blame path/to/file.py git stash push -m "wip experiment" git stash pop

Fix & sync

git restore --staged file.py git restore file.py git commit --amend
git rebase -i HEAD~4 git cherry-pick <commit-sha> git revert <commit-sha>

Remote & tags

git remote -v git fetch --all --prune git tag v1.0.0 git push origin v1.0.0