⌥ Git & GitHub1 / 1
Daily Git Workflow
📌 WHAT
Git is a distributed version control system that tracks changes to your code over time. GitHub hosts your Git repositories online and enables team collaboration.
💡 WHY
Never lose work. See every change ever made. Collaborate with a team without overwriting each other's work. Required at every software company.
⏰ WHEN / WHERE
Every day you write code. Commit often (after each small working change). Branch for each feature. PR to merge back to main.
🔧 HOW
The flow: pull → branch → code → add → commit → push → pull request. Use descriptive commit messages.
Code Examples
#1Complete daily workflow
Complete daily workflow
bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# ============================================# FIRST TIME: Clone repository# ============================================git clone https://github.com/company/project.gitcd project# ============================================# DAILY WORKFLOW# ============================================# Step 1: Always start by pulling latest changesgit pull origin main# Step 2: Create a new branch for your feature/fixgit checkout -b feature/user-authentication# Naming conventions:# feature/feature-name — new functionality# fix/bug-description — bug fixes# chore/task-name — maintenance, deps# hotfix/issue — urgent production fix# Step 3: Write your code...# ...# Step 4: See what changedgit status # see changed filesgit diff # see exact line changesgit diff src/components/Button.tsx # specific file# Step 5: Stage changesgit add . # stage everythinggit add src/components/Button.tsx # stage specific filegit add -p # interactively stage chunks# Step 6: Commit with descriptive messagegit commit -m "feat: add user authentication with Supabase"# Good commit message format:# type(scope): description# feat: new feature# fix: bug fix# docs: documentation# style: formatting# refactor: code change without behavior change# chore: build/dependency updates# Step 7: Push your branchgit push origin feature/user-authentication# Step 8: Open a Pull Request on GitHub# Then: teammate reviews → comments → approve → merge# ============================================# OTHER USEFUL COMMANDS# ============================================git log --oneline # see commit history (compact)git stash # save uncommitted changes temporarilygit stash pop # restore stashed changesgit diff main # compare your branch to maingit merge main # bring main changes into your branchgit rebase main # replay your commits on top of main (cleaner)# Undo last commit (keep changes staged)git reset --soft HEAD~1# Discard all local changes (CAREFUL: irreversible!)git checkout -- .
Practice This Concept
Open the playground, paste any example, and experiment. The best way to learn is by breaking things.
Open in Playground