Git Graphs
Git Graphs
A Git Graph is a visual representation of the commit history of a Git repository. It shows the sequence of commits and the relationships between them, making it easier to understand the branching, merging, and overall structure of a project’s development history.
Features of Git Graphs
Commits: Each node in the graph represents a commit, showing the commit hash, message, author, and timestamp.
Branches: Lines or colored paths represent different branches, helping you see their divergence and convergence.
Merges: Points where branches merge back together are clearly indicated, showing how code changes are integrated.
Tags: Annotated points in the graph highlight tags, such as version releases.
Mermaid.js is a powerful tool to create various diagrams, including Git graphs. Git graphs are particularly useful for visualizing commit histories and branch structures in Git repositories.
Examples
Basic Example : Checkout branch
gitGraph commit commit branch develop checkout develop commit commit checkout main commit
Git Branch Merge
gitGraph commit id: "Initial Commit" branch featureA checkout featureA commit id: "Feature A work" branch featureB checkout featureB commit id: "Feature B work" checkout main merge featureA id: "Merge Feature A" merge featureB id: "Merge Feature B"
Git Tags and Commit Messages
gitGraph commit id: "Initial Commit" branch feature1 checkout feature1 commit id: "Add feature1" tag: "v1.1" checkout main merge feature1 id: "Merge feature1" branch feature2 checkout feature2 commit id: "Start feature2" commit id: "Finish feature2" checkout main merge feature2 id: "Merge feature2" commit id: "Hotfix applied" tag: "v1.2"
Git Tutorials
Git Tutorial on this website can be found at: