Skip to content
Mermaid templates

Git: Rebase vs Merge (Decision)

A quick guide to choosing rebase or merge.

Template previewMermaid
Rendering…

Make it your own.

flowchart TD
    A([Integrating a branch?]) --> B{Is the branch<br/>shared/pushed?}
    B -->|Yes| C[Merge<br/>preserve history]
    B -->|No| D{Want a linear,<br/>clean history?}
    D -->|Yes| E[Rebase onto main]
    D -->|No| C
    E --> F{Conflicts?}
    F -->|Yes| G[Resolve per commit]
    F -->|No| H([Fast-forward merge])
    G --> H
    C --> I([Merge commit])