Stratpoint Engineering

Next.js Fullstack Training

Sign in with your Stratpoint Google account to continue.

Next.js Fullstack
Next.js Fullstack Training
Chapter 4

Git Cheat Sheet

4.1 Commands You'll Use Every Day

CommandWhat it doesWhen to use it
git statusShows what files changedBefore every commit
git pullDownload latest from GitHubEvery morning
git checkout -b name/type/descCreate a new feature branchStarting any new task
git add .Stage all changesBefore committing
git commit -m "type: message"Save with a messageEvery working state
git pushUpload to GitHubAfter committing, end of day
git rebase mainPull in latest main changesWhen main has new commits
git stashTemporarily hide changesWhen switching branches urgently
git log --onelineSee recent commit historyDebugging, orientation

4.2 Conventional Commits Format

Format:  type(scope): short description

 feat(tasks): add drag-and-drop between lists
 fix(auth): redirect to /login when session expires
 chore(deps): upgrade drizzle to v2.1.0

 "fixed stuff"  /  "WIP"  /  "update"
TypeWhen to use
featA new feature visible to the user
fixA bug fix
choreTooling, deps, config — nothing the user sees
refactorCode restructured without changing behaviour
testAdding or fixing tests
docsDocumentation only

4.3 Day-to-Day Git Flow (Capstone)

Because you work on your own fork, there is no shared branch to protect. Keep it simple:

  • git checkout main && git pull (sync with upstream if mentor pushed updates)
  • Write code. Commit often with Conventional Commits format.
  • git push (push to your fork main at end of each session)

Pro Tip

Feature branches are optional for the capstone — use them when working on something risky you might want to discard.

For project submissions (Foundations 1 & 2), you will share your repo URL directly with your mentor for review.

The only formal code review in this program happens on those two project submissions.

4.4 Fixing Common Mistakes

SituationFix
Committed to main by mistakegit checkout -b rescue/my-changes then git checkout main && git reset --hard origin/main
Undo last commit (keep changes)git reset --soft HEAD~1
Undo last commit (discard changes)git reset --hard HEAD~1 permanent
Rebase conflictRemove <<<< ==== >>>> markers. Keep correct code. git add . && git rebase --continue
Accidentally deleted a filegit checkout HEAD -- path/to/file.tsx

Common Mistake

NEVER run git push --force on main or a shared branch.

NEVER commit .env files. Add .env* to .gitignore immediately.

Accidentally committed a secret? Tell your mentor NOW. The key must be rotated.