Git Workflow Diagrams
Process Diagrams — BOOKMARK THIS¶
These are given to you. You are not asked to invent them. Diagram 1 is the loop you’ll run fourteen more times. BOOKMARK IT somewhere visible.
Diagram 1 — the weekly cycle¶
---
title: The loop, from backlog item to tagged release
---
flowchart TB
A["Sprint Planning"] --> B["Sprint Backlog
cards on the board"] B --> C["git switch -c week-NN-pattern"] C --> D["Build in small commits
feat / fix / test / docs"] D --> E{"mvn test
green?"} E -- no --> D E -- yes --> F["git push -u origin week-NN-pattern"] F --> G["Open Pull Request
PR template = the DoD"] G --> H{"CI green?
DoD all checked?"} H -- no --> D H -- yes --> I["Self-review, merge
Closes #NN"] I --> J["git tag vN.N.0"] J --> K["Sprint Review
demo what now works"] K --> L["Retrospective
docs/retro/sprint-NN.md"] L --> A style A fill:#A8DADC,stroke:#1D6F76,stroke-width:2px,color:#000 style H fill:#FFE08A,stroke:#B8860B,stroke-width:3px,color:#000 style I fill:#B7E4C7,stroke:#2D6A4F,stroke-width:2px,color:#000 style L fill:#F1C0E8,stroke:#A02C86,stroke-width:2px,color:#000
cards on the board"] B --> C["git switch -c week-NN-pattern"] C --> D["Build in small commits
feat / fix / test / docs"] D --> E{"mvn test
green?"} E -- no --> D E -- yes --> F["git push -u origin week-NN-pattern"] F --> G["Open Pull Request
PR template = the DoD"] G --> H{"CI green?
DoD all checked?"} H -- no --> D H -- yes --> I["Self-review, merge
Closes #NN"] I --> J["git tag vN.N.0"] J --> K["Sprint Review
demo what now works"] K --> L["Retrospective
docs/retro/sprint-NN.md"] L --> A style A fill:#A8DADC,stroke:#1D6F76,stroke-width:2px,color:#000 style H fill:#FFE08A,stroke:#B8860B,stroke-width:3px,color:#000 style I fill:#B7E4C7,stroke:#2D6A4F,stroke-width:2px,color:#000 style L fill:#F1C0E8,stroke:#A02C86,stroke-width:2px,color:#000
Diagram 2 — what your branch history should look like¶
---
title: Feature-branch workflow, Weeks 2 through 5
---
gitGraph
commit id: "initial"
branch chore/walking-skeleton
commit id: "templates+CI"
commit id: "skeleton+test"
commit id: "supplied docs"
checkout main
merge chore/walking-skeleton tag: "v0.1.0"
branch week-03-singleton
commit id: "GameConfig"
commit id: "RandomSource"
commit id: "SingletonTest"
checkout main
merge week-03-singleton tag: "v0.3.0"
branch week-04-factory
commit id: "ThemeKit"
checkout main
merge week-04-factory tag: "v0.4.0"
Diagram 3 — the three trees¶
---
title: The mental model that makes Git make sense
---
flowchart LR
W["Working Directory
files you edit"] -->|"git add"| S["Staging Area
what goes in next commit"] S -->|"git commit"| H["HEAD / Local Repo
recorded history"] H -->|"git push"| R["Remote (GitHub)
shared history"] S -.->|"git restore --staged"| W H -.->|"git reset"| S R -.->|"git pull"| H H -.->|"git switch"| W style W fill:#FFD6A5,stroke:#B25E00,stroke-width:2px,color:#000 style S fill:#FDFFB6,stroke:#8A8A00,stroke-width:2px,color:#000 style H fill:#B7E4C7,stroke:#2D6A4F,stroke-width:2px,color:#000 style R fill:#A8DADC,stroke:#1D6F76,stroke-width:2px,color:#000
files you edit"] -->|"git add"| S["Staging Area
what goes in next commit"] S -->|"git commit"| H["HEAD / Local Repo
recorded history"] H -->|"git push"| R["Remote (GitHub)
shared history"] S -.->|"git restore --staged"| W H -.->|"git reset"| S R -.->|"git pull"| H H -.->|"git switch"| W style W fill:#FFD6A5,stroke:#B25E00,stroke-width:2px,color:#000 style S fill:#FDFFB6,stroke:#8A8A00,stroke-width:2px,color:#000 style H fill:#B7E4C7,stroke:#2D6A4F,stroke-width:2px,color:#000 style R fill:#A8DADC,stroke:#1D6F76,stroke-width:2px,color:#000