Git Workflows
Use these steps to keep changes clean and reviewable.
Safe sync
- •
git statusto confirm a clean working tree. - •
git fetch --all --pruneto update remote refs. - •
git rebase origin/main(or your target branch) to keep history linear.
New branch setup
- •
git checkout -b feature/<short-name>. - •Commit in small, reviewable chunks.
- •Push with
git push -u origin feature/<short-name>.
Before opening a PR
- •
git statusandgit diffto verify changes. - •
git log --oneline --decorate -n 10to check commit history. - •Squash or fixup commits if needed.
Recover tips
- •
git reflogto find previous HEAD positions. - •
git reset --hard <sha>only when you are sure no work will be lost.