Git Branch Flow Visual Guide
Core Branch Structure
graph TD
subgraph "Feature Development"
F1["feature/feature1"] --> |Auto PR| D
F2["feature/feature2"] --> |Auto PR| D
F3["fix/bugfix"] --> |Auto PR| D
end
subgraph "Integration & Release Pipeline"
D["dev (integration)"] --> |PR| S
S["staging (pre-release)"] --> |Release PR| M
M["master (production)"]
end
H["hotfix/critical-fix"] --> |Emergency PR| M
H -.-> |Backport PR| S
H -.-> |Backport PR| D
style M fill:#ff9999,stroke:#333
style S fill:#ffcc99,stroke:#333
style D fill:#99ccff,stroke:#333
style F1 fill:#ccffcc,stroke:#333
style F2 fill:#ccffcc,stroke:#333
style F3 fill:#ccffcc,stroke:#333
style H fill:#ff99cc,stroke:#333
Automated Synchronization
graph LR
M["master"] --> |Daily rebase| S
S["staging"] --> |Daily rebase| D
D["dev"]
style M fill:#ff9999,stroke:#333
style S fill:#ffcc99,stroke:#333
style D fill:#99ccff,stroke:#333
Feature Branch Lifecycle
sequenceDiagram
participant Dev as Developer
participant FB as Feature Branch
participant D as dev branch
participant GH as GitHub Actions
participant PR as Pull Request
Dev->>D: git checkout dev
Dev->>FB: Create feature branch
Dev->>FB: Make changes and commit
Dev->>FB: Push to origin
FB->>GH: Trigger Actions workflow
GH->>GH: Build & Test
GH->>PR: Create PR to dev
PR->>D: Merge after approval
Release Process
sequenceDiagram
participant Dev as Developer
participant S as staging
participant RL as Release Branch
participant GH as GitHub Actions
participant M as master
Dev->>GH: Run release workflow
GH->>S: checkout staging
GH->>RL: Create release branch
GH->>RL: Update version
GH->>PR: Create PR to master
GH->>GH: Create draft release
PR->>M: Merge after approval
GH->>GH: Publish GitHub release
Branching Timeline Example
gitGraph
commit
commit
branch dev
checkout dev
commit
branch feature/login
checkout feature/login
commit
commit
checkout dev
merge feature/login
branch feature/dashboard
checkout feature/dashboard
commit
commit
checkout dev
merge feature/dashboard
checkout main
branch hotfix/security
checkout hotfix/security
commit
checkout main
merge hotfix/security
checkout dev
merge main
branch staging
checkout staging
commit
commit
checkout main
merge staging tag:"v1.0.0"
Common Git Commands
Operation |
Command |
Create feature branch |
git checkout -b feature/name |
Push to remote |
git push -u origin feature/name |
Rebase on dev |
git rebase dev |
Force push after rebase |
git push --force-with-lease |
Update local branch |
git pull origin dev |
Check branch status |
git status |
View commit history |
git log --oneline --graph |
View remote branches |
git branch -r |