From 33f538ebf4b2a1c9cc1e429d31cc00fdc8e73d68 Mon Sep 17 00:00:00 2001 From: Corey Johnson & Kevin Sawicki Date: Wed, 10 Jul 2013 15:52:47 -0700 Subject: [PATCH] Create new branch if guest has unpushed changes --- src/packages/collaboration/lib/bootstrap.coffee | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/packages/collaboration/lib/bootstrap.coffee b/src/packages/collaboration/lib/bootstrap.coffee index d70da3d36..18149143c 100644 --- a/src/packages/collaboration/lib/bootstrap.coffee +++ b/src/packages/collaboration/lib/bootstrap.coffee @@ -53,7 +53,17 @@ syncRepositoryState = -> return else # prompt for new branch name - # create branch at head + + i = 1 + loop + newBranch = "#{branch}-#{i++}" + break unless git.hasBranch(newBranch) + + command = "git checkout -b #{newBranch} #{head}" + exec command, {cwd: repoPath}, (error, stdout, stderr) -> + if error? + console.error error + return else # create branch at head