{"id":21384456,"url":"https://github.com/daljitdokal/git-graph-js-example","last_synced_at":"2025-10-24T23:53:38.699Z","repository":{"id":47079463,"uuid":"515828375","full_name":"daljitdokal/git-graph-js-example","owner":"daljitdokal","description":"Git Graph js example","archived":false,"fork":false,"pushed_at":"2022-07-20T04:46:14.000Z","size":247,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T23:41:10.302Z","etag":null,"topics":["git","gitgraph"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daljitdokal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-20T04:07:25.000Z","updated_at":"2022-07-20T04:34:08.000Z","dependencies_parsed_at":"2022-09-10T17:40:31.055Z","dependency_job_id":null,"html_url":"https://github.com/daljitdokal/git-graph-js-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daljitdokal%2Fgit-graph-js-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daljitdokal%2Fgit-graph-js-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daljitdokal%2Fgit-graph-js-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daljitdokal%2Fgit-graph-js-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daljitdokal","download_url":"https://codeload.github.com/daljitdokal/git-graph-js-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243864611,"owners_count":20360355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","gitgraph"],"created_at":"2024-11-22T11:40:58.889Z","updated_at":"2025-10-09T22:39:31.142Z","avatar_url":"https://github.com/daljitdokal.png","language":"HTML","readme":"# Git Graph js example\nA JavaScript [library](https://www.nicoespeon.com/gitgraph.js/#0) to draw pretty git graphs.\n\n![Git Graph js example](https://github.com/daljitdokal/git-graph-js-example/blob/main/example.PNG)\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003clink rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.css\" /\u003e\n    \u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.js\"\u003e\u003c/script\u003e\n\t\u003cstyle\u003e*{font-family:Arial;}\u003c/style\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\u003ccanvas id=\"graph\"\u003e\u003c/canvas\u003e\u003c/body\u003e\n  \n  \u003cscript\u003e\n\n\tconst main = {\n\t  prod:    {index: 2, name: \"prod\"},\n\t  stag:    {index: 3, name: \"stag\"},\n\t  test:    {index: 4, name: \"test\"},\n\t  dev:     { index: 5, name: \"dev\" },\n\t  feature: { index: 6, name: \"feature\"},\n\t  bugfix:  { index: 7, name: \"bugfix\" },\n\t  hotfix:  { index: 1, name: \"hotfix\" }\n\t};\n\tconst myTemplateConfig = {\n\t  colors: [ \"#f28e2c\", \"#e15759\", \"#59a14f\", \"#76b7b2\", \"#af7aa1\", \"#edc949\", \"#bab0ab\", \"#9c755f\", \"#bab0ab\" ],\n\t  branch: { lineWidth: 8, spacingX: 50, showLabel: true, labelFont: \"normal 14pt Courier New\", labelRotation: 0},\n\t  commit: { spacingY: -40, dot: { size: 12 },message: { displayAuthor: true, displayBranch: true, displayHash: false, font: \"normal 12pt Arial\" }, shouldDisplayTooltipsInCompactMode: \"true\", tooltipHTMLFormatter: function (commit) { return \"\" + commit.sha1 + \"\" + \": \" + commit.message; } } \n\t};\n\t  \n\tvar myTemplate = new GitGraph.Template(myTemplateConfig);\n\n\tconst gitgraph = new GitGraph({ orientation: \"vertical\", author: \"Daljit Singh\u003cdaljitdokal@yahoo.co.nz\u003e\", elementId: \"graph\", initCommitOffsetX: 0, initCommitOffsetY: 0, mode: \"extended\", template: myTemplate });\n\n\tconst prod = gitgraph.branch({name: \"production\", column: main[\"prod\"][\"index\"]}).commit({ message: \"Initial Commit\" });\n\tconst stag= gitgraph.branch({parentBranch: prod, name: \"staging\", column: main[\"stag\"][\"index\"]}).commit({ message: \"Branch created\" });\n\tconst test = gitgraph.branch({parentBranch: stag, name: \"test\", column: main[\"test\"][\"index\"]}).commit({ message: \"Branch created\" });\n\tconst dev = gitgraph.branch({parentBranch: test, name: \"development\", column: main[\"dev\"][\"index\"]}).commit({ message: \"Branch created\" });\n\n\n\tconst devCommit = {messageDisplay: false,};\n\tdev.commit(devCommit);\n\n\tconst hotFix = function (name, parent) {\n\t  return gitgraph.branch({parentBranch: parent, name: name, column: main[\"hotfix\"][\"index\"]});\n\t};\n\n\tconst addFeature = function (name) {\n\t  return gitgraph.branch({\n\t\tparentBranch: dev,\n\t\tname: `feature/${name}`,\n\t\tcolumn: main[\"feature\"][\"index\"]\n\t  });\n\t};\n\n\tconst aFeature = addFeature(\"new-feature\").commit(\"Starting work on feature for next release\");\n\taFeature.merge(dev);\n\tdev.merge(test);\n\ttest.merge(stag);\n\tstag.merge(prod);\n\n\n\tstag.commit(\"Using as\").tag(\"Tag-stg v2.0\");\n\ttest.commit(\"Using as\").tag(\"Tag-test v2.0\");\n\tdev.commit(\"Using as\").tag(\"Tag-dev v2.0\");\n\tprod.commit(\"Using as\").tag(\"Tag-prd v1.0\");\n\n\n\tconst aHotFix = hotFix(\"hotfix/bug-fix\", prod).commit(\"Hotfix for production bug\");\n\taHotFix.merge(prod);\n\tprod.merge(stag);\n\tstag.merge(test);\n\ttest.merge(dev);\n\n\n\tdev.commit(devCommit);\n\tconst bFeature = addFeature(\"another-feature\").commit(\"code updated\");\n\tbFeature.merge(dev);\n\tdev.merge(test);\n\ttest.merge(stag);\n\n\t\u003c!-- stag.merge(prod); --\u003e\n\n  \u003c/script\u003e\n\u003c/html\u003e\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaljitdokal%2Fgit-graph-js-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaljitdokal%2Fgit-graph-js-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaljitdokal%2Fgit-graph-js-example/lists"}