Module 5 of 6

Git Workflows

Master version control with confidence. No more git fear.

1

Daily Git Commands

The commands you'll use every single day

git status Check what's changed
git add . Stage all changes
git commit -m "msg" Save your changes
git push Upload to GitHub
git pull Download updates
git diff See exact changes
💡

Use Warp AI

Type # commit my changes with message "added login feature" and Warp builds the command for you.

2

Branching

Work on features without breaking main

Branching Workflow
# Create new branch
git checkout -b feature/add-login
# Work on your code...
# Push your branch
git push -u origin feature/add-login
git branch List all branches
git checkout main Switch to main
git checkout -b name Create & switch
git branch -d name Delete branch
3

Merging & Pull Requests

Combine your work with the team's

1

Push your branch

git push -u origin your-branch

2

Create Pull Request on GitHub

Go to GitHub and click "Compare & pull request"

3

Get it reviewed

Team reviews your code and approves

4

Merge!

Click "Merge pull request" on GitHub

Quick PR with GitHub CLI

Type # create a pull request and Warp will help you use the gh command.

4

Undo Mistakes

Everyone makes mistakes. Here's how to fix them.

git checkout -- file Discard file changes
git reset HEAD~1 Undo last commit (keep changes)
git stash Temporarily save changes
git stash pop Restore stashed changes
Common Undo Scenarios
# "I want to undo my last commit"
git reset --soft HEAD~1
# "I committed to wrong branch"
git reset --soft HEAD~1
git stash
git checkout correct-branch
git stash pop
5

Resolve Conflicts

When git can't auto-merge your changes

1

Git tells you there's a conflict

You'll see "CONFLICT" in the terminal

2

Open the conflicted file

Look for <<<<<<< and >>>>>>> markers

3

Choose which code to keep

Delete the markers and keep the correct code

4

Mark as resolved

git add . then git commit

💡

VS Code makes this easy

VS Code shows "Accept Current" / "Accept Incoming" buttons right in the editor. Just click!

Quick reference for everything?

View Cheat Sheet