NOTE: For best experience, please use Chrome Browser!
Branching #
One Branch
Multiple Branches
Gitflow
Git Architecture #
%% Git Lifecycle Diagram with Forward and Reverse Flows flowchart TB subgraph Git Lifecycle WD((WorkingDirectory)) IDX((Index/StagingArea)) LOD((LocalObjectDatabase)) REM((RemoteObjectDatabase)) end %% Forward flow WD -->|git add| IDX IDX -->|git commit| LOD LOD -->|git push| REM %% Reverse flow IDX -->|git restore --staged| WD LOD -->|git restore / git reset| IDX REM -->|git fetch| LOD classDef nodeStyle fill:#f9f9f9,stroke:#333,stroke-width:1px; class WD,IDX,LOD,REM nodeStyle;
Git File States #
flowchart LR subgraph WD[Working Directory] UNTRACKED(Untracked<br/>NewFile) MODIFIED(Modified<br/>ChangedNotStaged) UNMODIFIED(Unmodified<br/>NoChangesSinceLastCommit) end subgraph IDX[Index / Staging Area] STAGED(Staged<br/>ReadyToCommit) end subgraph CLONE[Local Object Database] COMMITTED(CommittedToClone) end subgraph REMOTE[Remote Object Database] PUSHED(PushedToRemote) end %% Flows UNTRACKED -->|git add| STAGED MODIFIED -->|git add| STAGED STAGED -->|git commit| COMMITTED COMMITTED -->|git push| PUSHED UNMODIFIED -->|edit| MODIFIED
Mainline Development #
gitGraph commit id: "Init Repo" checkout main commit id: "Initial Commit" commit id: "Add Feature A" commit id: "Add Feature B" commit id: "Fix Bug" commit id: "Release v1.0"
Feature Development #
gitGraph commit id: "Init Repo" checkout main commit id: "Initial Commit" branch feature-login checkout feature-login commit id: "Add login page" commit id: "Add login styles" checkout main merge feature-login id: "Merge feature-login" branch feature-user checkout feature-user commit id: "Add user page" commit id: "Add user styles" checkout main merge feature-user id: "Merge feature-user"
Feature Development #
gitGraph commit id: "Init Repo" checkout main commit id: "Initial Commit" branch feature-login checkout feature-login commit id: "Add login page" commit id: "Add login styles" checkout main merge feature-login id: "Merge feature-login" branch feature-user checkout feature-user commit id: "Add user page" commit id: "Add user styles" checkout main merge feature-user id: "Merge feature-user"
Complex Workflow For Advanced Projects #
gitGraph commit branch integration-a branch feature-a checkout feature-a commit commit checkout integration-a branch feature-b checkout feature-b commit commit checkout integration-a merge feature-a checkout feature-b commit commit checkout integration-a checkout main branch bug-fix-a checkout bug-fix-a commit checkout main merge bug-fix-a checkout integration-a merge bug-fix-a checkout main branch bug-fix-b checkout bug-fix-b commit checkout main merge bug-fix-b checkout integration-a merge bug-fix-b checkout feature-b commit checkout integration-a merge feature-b checkout main merge integration-a
Gitflow #
gitGraph commit branch develop branch feature-a checkout feature-a commit commit checkout develop branch feature-b checkout feature-b commit commit checkout develop merge feature-a checkout feature-b commit commit checkout develop checkout main branch bug-fix-a checkout bug-fix-a commit checkout main merge bug-fix-a checkout develop merge bug-fix-a checkout main branch bug-fix-b checkout bug-fix-b commit checkout main merge bug-fix-b checkout develop merge bug-fix-b checkout feature-b commit checkout develop merge feature-b checkout develop branch release-v1 commit commit checkout develop merge release-v1 checkout main merge release-v1
25 commits #
gitGraph commit commit commit commit commit commit commit commit commit commit commit commit commit