 writeRepo = (repo, filepath, contents)->
   utils.writeFile "./#{tmpWorkspace}/#{repo}/#{filepath}", contents
 
+gitCheckout = (repo, branch, create=false)->
+  command = "git checkout #{if create then '-b ' else ''}#{branch}"
+  console.log "COMMAND", command
+  utils.cmd "#{tmpWorkspace}/#{repo}", command
+
+gitHead = (repo)->
+  utils.readFile("#{tmpWorkspace}/#{repo}/.git/HEAD").then (contents)->
+    # match = /refs\/heads\/(.*$)/.match(contents)[1]
+    # console.log("MATCH", match)
+    head = /refs\/heads\/(.*$)/.exec(contents)[1]
+    Promise.resolve head
+
 configureServer = (repo)->
   Promise.all [
     #allow pushing to the active branch

            isClean('server').should.eventually.equal(false)
          ])

    it "remote repo should be clean after the user makes a commit"

    it "should handle a branch switch"

    it "should handle a commit amendment"


    if repo.isEmpty()
      return Promise.resolve null
    else
      repo.getHeadCommit()
  .then (firstComitOnMaster) ->
    if firstComitOnMaster == null
      return Promise.resolve null
