Skip to content

Visualization of Git History

Bogdan Dit edited this page Oct 14, 2026 · 1 revision

Task 2 Visualization

Task 2: After creating the branch

---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    commit id: "C4 [main]"
    commit id: "C5 [main]"
    commit id: "C6 [main]" tag: "main"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2" tag: "task_2_merge"
Loading

Task 2: After integrating the branch (via merge)

---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    commit id: "C4 [main]"
    commit id: "C5 [main]"
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2" tag: "task_2_merge"

    checkout main
    merge task_2_merge id: "Merge"  tag: "main"
Loading

Task 2: After deleting the branch

  • NOTE: even though the branch task_2_merge was deleted, the branch trace is still present, cluttering the repository history
---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    commit id: "C4 [main]"
    commit id: "C5 [main]"
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge" tag: "main"
Loading

Task 3 Visualization

Task 3: After creating the branch

---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    commit id: "C5 [main]"
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"  tag: "main"

    checkout task_3_rebase
    commit id: "first partial commit for task #3"
    commit id: "another partial commit for task three (oops, forgot the traceability)"
    commit id: "yet another partial commit for task #3"
    commit id: "yet another partial commit for task three (oops, forgot the traceability)"
    commit id: "last partial commit for task three (oops, forgot the traceability)" tag: "task_3_rebase"
Loading

Task 3: After integrating the branch (via rebase)

  • NOTE: all the commits from branch task_3_rebase were "copied" (rebased) into the main branch, cluttering the repository history with multiple commits that contain partial (and incomplete) implementations of the task
---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    commit id: "C5 [main]"
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout task_3_rebase
    commit id: "first partial commit for task #3"
    commit id: "another partial commit for task three (oops, forgot the traceability)"
    commit id: "yet another partial commit for task #3"
    commit id: "yet another partial commit for task three (oops, forgot the traceability)"
    commit id: "last partial commit for task three (oops, forgot the traceability)" tag: "task_3_rebase"

    %% to keep the commit ids unique for mermaid,
    %% we add a space at the end of the commit id to simulate rebasing
    %% in the visualization it will show that the original commit and
    %% the rebased (copied) commit have the same message,
    %% but mermaid will not complain that the ids are not unique
    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) " tag: "main"
Loading

Task 3: After deleting the branch

  • NOTE: the branch task_3_rebase was deleted successfully from the repository, but the five rebased (copied) commits still clutter the main branch
---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    commit id: "C5 [main]"
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) " tag: "main"
Loading

Task 4 Visualization

Task 4: After creating the branch

---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    branch task_4_squash
    checkout main
    commit id: "C5 [main]"
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) " tag: "main"

    checkout task_4_squash
    commit id: "first partial commit for task #4"
    commit id: "another partial commit for task #4"
    commit id: "another partial commit for task four (oops, forgot the traceability)"
    commit id: "yet another partial commit for task 4 (without hashtag in front, no traceability will be established)"
    commit id: "last partial commit for task #4" tag: "task_4_squash"
Loading

Task 4: After integrating the branch (via squash)

  • NOTE: all the commits from branch task_4_squash were squashed/compressed/bundled into a single "atomic" commit that was added to the main branch
  • NOTE: the squashed commit is represented as a square in the diagram below
---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    branch task_4_squash
    checkout main
    commit id: "C5 [main]"
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) "

    checkout task_4_squash
    commit id: "first partial commit for task #4"
    commit id: "another partial commit for task #4"
    commit id: "another partial commit for task four (oops, forgot the traceability)"
    commit id: "yet another partial commit for task 4 (without hashtag in front, no traceability will be established)"
    commit id: "last partial commit for task #4" tag: "task_4_squash"

    checkout main
    commit id: "Task 4 squash (#9)" type: HIGHLIGHT tag: "main"
Loading

Task 4: After deleting the branch

  • NOTE: the branch task_4_squash was deleted successfully from the repository, reducing the repository clutter
---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    branch task_4_squash
    checkout main
    commit id: "C5 [main]"
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) "

    checkout main
    commit id: "Task 4 squash (#9)" type: HIGHLIGHT tag: "main"
Loading

Task 5 Visualization

Task 5: After creating the branch

---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    branch task_4_squash
    checkout main
    commit id: "C5 [main]"
    branch task_5_squash_with_link_to_task
    checkout main
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) "

    checkout main
    commit id: "Task 4 squash (#9)" type: HIGHLIGHT tag: "main"

    checkout task_5_squash_with_link_to_task
    commit id: "First partial commit for task #5"
    commit id: "Second partial commit for task five, but forgot to put the traceability"
    commit id: "Also, when working on a branch..."
    commit id: "...it is tedious, error-prone and cumbersome to..."
    commit id: "...put the traceability to the task (i.e., #5) on every commit."
    commit id: "Luckily, with squashing, we do not need..."
    commit id: "...to put the traceability on every commit in the branch."
    commit id: "Instead, we put the traceability during squashing."
    commit id: "Last partial commit for task #5" tag: "task_5_squash_with_link_to_task"
Loading

Task 5: After integrating the branch (via squash)

---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    branch task_4_squash
    checkout main
    commit id: "C5 [main]"
    branch task_5_squash_with_link_to_task
    checkout main
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) "

    checkout main
    commit id: "Task 4 squash (#9)" type: HIGHLIGHT

    checkout task_5_squash_with_link_to_task
    commit id: "First partial commit for task #5"
    commit id: "Second partial commit for task five, but forgot to put the traceability"
    commit id: "Also, when working on a branch..."
    commit id: "...it is tedious, error-prone and cumbersome to..."
    commit id: "...put the traceability to the task (i.e., #5) on every commit."
    commit id: "Luckily, with squashing, we do not need..."
    commit id: "...to put the traceability on every commit in the branch."
    commit id: "Instead, we put the traceability during squashing."
    commit id: "Last partial commit for task #5" tag: "task_5_squash_with_link_to_task"

    checkout main
    commit id: "Closes #5 (#10)" type: HIGHLIGHT tag: "main"
Loading

Task 5: After deleting the branch

---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    branch task_4_squash
    checkout main
    commit id: "C5 [main]"
    branch task_5_squash_with_link_to_task
    checkout main
    commit id: "C6 [main]"

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) "

    checkout main
    commit id: "Task 4 squash (#9)" type: HIGHLIGHT

    checkout main
    commit id: "Closes #5 (#10)" type: HIGHLIGHT tag: "main"
Loading

Task 6 Visualization

Task 6: After creating the branch

---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    branch task_4_squash
    checkout main
    commit id: "C5 [main]"
    branch task_5_squash_with_link_to_task
    checkout main
    commit id: "C6 [main]"
    branch task_6_squash_preferred_project_workflow
    checkout main

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) "

    checkout main
    commit id: "Task 4 squash (#9)" type: HIGHLIGHT

    checkout main
    commit id: "Closes #5 (#10)" type: HIGHLIGHT tag: "main"

    checkout task_6_squash_preferred_project_workflow
    commit id: "First partial commit for task six (without traceability between commit and task)"
    commit id: "Second partial commit for task six (without traceability between commit and task)"
    commit id: "This is the preferred workflow:"
    commit id: "No traceability to the commits in the branch..."
    commit id: "...but clear traceability for the squashed commit..."
    commit id: "...to the task and PR during integration."
    commit id: "Last partial commit for task six (without traceability between commit and task)" tag: "task_6_squash_preferred_project_workflow"
Loading

Task 6: After integrating the branch (via squash)

---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    branch task_4_squash
    checkout main
    commit id: "C5 [main]"
    branch task_5_squash_with_link_to_task
    checkout main
    commit id: "C6 [main]"
    branch task_6_squash_preferred_project_workflow
    checkout main

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) "

    checkout main
    commit id: "Task 4 squash (#9)" type: HIGHLIGHT

    checkout main
    commit id: "Closes #5 (#10)" type: HIGHLIGHT

    checkout task_6_squash_preferred_project_workflow
    commit id: "First partial commit for task six (without traceability between commit and task)"
    commit id: "Second partial commit for task six (without traceability between commit and task)"
    commit id: "This is the preferred workflow:"
    commit id: "No traceability to the commits in the branch..."
    commit id: "...but clear traceability for the squashed commit..."
    commit id: "...to the task and PR during integration."
    commit id: "Last partial commit for task six (without traceability between commit and task)" tag: "task_6_squash_preferred_project_workflow"

    checkout main
    commit id: "Closes #6 (#11)" type: HIGHLIGHT tag: "main"
Loading

Task 6: After deleting the branch

---
config:
  gitGraph:
    showBranches: false
  themeVariables:
    git0: "#8b949e"
    git1: "#1f6feb"
    git2: "#cf222e"
    git3: "#bf8700"
    git4: "#a371f7"
    git5: "#2da44e"
---
gitGraph
    commit id: "C1 [main]"
    commit id: "C2 [main]"
    branch task_2_merge
    checkout main
    commit id: "C3 [main]"
    branch task_3_rebase
    checkout main
    commit id: "C4 [main]"
    branch task_4_squash
    checkout main
    commit id: "C5 [main]"
    branch task_5_squash_with_link_to_task
    checkout main
    commit id: "C6 [main]"
    branch task_6_squash_preferred_project_workflow
    checkout main

    checkout task_2_merge
    commit id: "first partial commit for task #2"
    commit id: "second partial commit for task #2"
    commit id: "third and last partial commit for task #2"

    checkout main
    merge task_2_merge id: "Merge"

    checkout main
    commit id: "first partial commit for task #3 "
    commit id: "another partial commit for task three (oops, forgot the traceability) "
    commit id: "yet another partial commit for task #3 "
    commit id: "yet another partial commit for task three (oops, forgot the traceability) "
    commit id: "last partial commit for task three (oops, forgot the traceability) "

    checkout main
    commit id: "Task 4 squash (#9)" type: HIGHLIGHT

    checkout main
    commit id: "Closes #5 (#10)" type: HIGHLIGHT

    checkout main
    commit id: "Closes #6 (#11)" type: HIGHLIGHT tag: "main"
Loading