markdown Gitgraph(分支图)

Last updated on November 20, 2024 am

🧙 Questions

分支图: 用于说明合并分支的方式,多用于复杂的分支合并

☄️ Ideas

命令说明

  • commit : 提交代码
  • branch : 创建分支
  • checkout : 切换分支
  • merge : 合并分支
  • cherry-pick : 部分合并

分支节点状态

  • NORMAL : 普通
  • REVERSE : 撤回
  • HIGHLIGHT : 高亮

打标签

commit id: "Highlight" type: HIGHLIGHT tag: "8.8.4"

分支排序

branch test1 order: 3

自定义样式

%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'rotateCommitLabel': true}} }%%

  • theme : 主题 [base (推荐) / forest / dark / default / neutral]
  • rotateCommitLabel : false 水平显示label/true倾斜显示label
  • showCommitLabel : false不显示label/true显示label
  • showBranches : false不显示分支/true显示分支
  • mainBranchName : 默认root分支名称
  • mainBranchOrder : root分支排序
  • themeVariables : 自定义主题
{
  'git0': '#ff0000', // 分支线的颜色
  'git1': '#00ff00', 
  'gitInv0': '#ff0000', // commit的颜色
  'gitBranchLabel0': '#ffffff', // 分支label颜色
  'tagLabelColor': '#ff0000', // tag字颜色
  'tagLabelBackground': '#00ff00', // tag背景色
  'tagLabelBorder': '#0000ff', // tag边框色
  'tagLabelFontSize': '16px' // tag字体大写
  'commitLabelColor': '#ff0000', // label字体颜色
  'commitLabelBackground': '#00ff00', // label背景色
  'commitLabelFontSize': '16px' // label字体大小
}

基础语法

%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'mainBranchName': '0.0.1'}} }%%
gitGraph
    commit id: "start"
    branch 0.0.1-feat1
    commit id: "feat1-1"
    checkout 0.0.1
    branch 0.0.1-feat2
    commit id: "feat2-1"
    commit id: "feat2-2"
    checkout 0.0.1-feat1
    commit id: "feat1-2"
    cherry-pick id: "feat2-1"
    commit id: "feat1-3"
    checkout 0.0.1
    merge 0.0.1-feat1
    commit id: "make tag" type: HIGHLIGHT tag: "0.0.2"
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'mainBranchName': '0.0.1'}} }%%
gitGraph
    commit id: "start"
    branch 0.0.1-feat1 order: 2
    commit id: "feat1-1"
    checkout 0.0.1
    branch 0.0.1-feat2 order: 1
    commit id: "feat2-1"
    commit id: "feat2-2"
    checkout 0.0.1-feat1
    commit id: "feat1-2"
    cherry-pick id: "feat2-1"
    commit id: "feat1-3"
    checkout 0.0.1
    merge 0.0.1-feat1
    commit id: "make tag" type: HIGHLIGHT tag: "0.0.2"
gitGraph
    commit id: "超稳定的分支"
    checkout main
    branch latest order: 2
    commit id:"正常迭代分支"
    branch 0.1.0 order: 3
    commit id:"首次迭代,初始化项目"
    checkout latest
    merge 0.1.0
    commit id: "发版0.1.0" type: REVERSE tag: "0.1.0"
    branch 0.1.0-1 order: 4
    checkout 0.1.0-1
    commit id:"开发#1需求"
    checkout latest
    branch 0.1.0-2 order: 5
    commit id:"开发#2需求"
    checkout latest
    branch 0.2.0 order: 6
    merge 0.1.0-1
    merge 0.1.0-2
    checkout latest
    merge 0.2.0
    commit id: "发版0.2.0" type: REVERSE tag: "0.2.0"
    branch 0.2.0-3 order: 7
    commit id:"开发#3需求"
    checkout latest
    branch 0.2.0-4 order: 8
    commit id:"修改#4的bug"
    checkout latest
    branch 0.2.1 order: 9
    merge 0.2.0-4
    checkout latest
    merge 0.2.1
    commit id:"发版0.2.1" type: REVERSE tag: "0.2.1"
    checkout latest
    branch 0.2.1-5 order: 10
    commit id:"开发#5需求"
    checkout latest
    branch 0.3.0 order: 11
    merge 0.2.0-3
    merge 0.2.1-5
    checkout latest
    merge 0.3.0
    commit id: "发版0.3.0" type: REVERSE tag: "0.3.0"
    checkout main
    merge latest
    checkout 0.2.1
    branch 0.2.1-8 order: 12
    commit id:"客户花钱需要改的#8的bug"
    checkout 0.2.1
    branch 0.2.2 order: 13
    merge 0.2.1-8
    commit id: "客户的0.2.2版本" type: REVERSE tag: "0.2.2"
    checkout latest
    branch 0.3.0-9 order: 14
    commit id:"开发#9需求"
    checkout latest
    branch 1.0.0 order: 15
    merge 0.3.0-9
    checkout latest
    merge 1.0.0
    commit id: "发版1.0.0" type: REVERSE tag: "1.0.0"
    checkout main
    merge latest

markdown Gitgraph(分支图)
https://ispong.isxcode.com/github/markdown/markdown Gitgraph(分支图)/
Author
ispong
Posted on
November 22, 2022
Licensed under