From 7bd9286a9b1ca82491fc92b9e17a2860488d8afc Mon Sep 17 00:00:00 2001 From: Ashish Jain Date: Thu, 10 Mar 2022 20:08:26 +0100 Subject: [PATCH] fix checkout if branch already exist --- src/diagrams/git/gitGraphAst.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/diagrams/git/gitGraphAst.js b/src/diagrams/git/gitGraphAst.js index ef55a8753..d449768b8 100644 --- a/src/diagrams/git/gitGraphAst.js +++ b/src/diagrams/git/gitGraphAst.js @@ -135,6 +135,10 @@ export const merge = function (otherBranch) { export const checkout = function (branch) { log.debug('in checkout'); + if (!branches[branch]) { + branches[branch] = head != null ? head.id : null; + log.debug('in createBranch'); + } curBranch = branch; const id = branches[curBranch]; head = commits[id];