anchor.diff:          final newCommitSha = pr.stdout.trim();
           ctx.info('Create new commit: $newCommitSha');
   
  +        final branchNameRef = 'refs/heads/$targetBranch';
  +
           return gitDir.runCommand(['update-ref', branchNameRef, newCommitSha]);
         })
         .then((ProcessResult pr) {
  
positive.code: 
    final gitDir = new GitDir(workingDir);
  
    return gitDir.lsTree(sourceBranch, subTreesOnly: true, path: sourceDir)
        .then((List<TreeEntry> entries) {
          assert(entries.length <= 1);
          if(entries.isEmpty) {
            throw 'Could not find a matching dir on the provided branch';
          }
          return _fromSourceDirTree(ctx, entries.single, targetBranch, sourceDir, sourceBranch, gitDir);
        });
  }
  
  Future<bool> _fromSourceDirTree(TaskContext ctx, TreeEntry tree,
      String targetBranch, String sourceDir, String sourceBranch, GitDir gitDir) {
    final sha = tree.sha;
  
    final gitArgs = new List<String>.from(['commit-tree', sha]);
  
    return gitDir.getBranchReference(targetBranch)
        .then((BranchReference branchRef) {
  
          if(branchRef == null) {
            // branch does not exist. New branch!
            return _goCommit(ctx, 'created', gitArgs, sourceBranch,
                sourceDir, targetBranch, gitDir);
          } else {
            // existing branch
            return _withExistingBranch(ctx, branchRef, sha, sourceDir, gitArgs,
                sourceBranch, targetBranch, gitDir);
          }
        });
  }
  
negative.code: Future<bool> _withExistingBranch(TaskContext ctx, BranchReference targetBranchRef, String dirSha,
      String sourceDir, List<String> gitArgs, String sourceBranch, String targetBranch, GitDir gitDir) {
  
    return gitDir.getCommit(targetBranchRef.sha)
        .then((Commit commitObj) {
          if(commitObj.treeSha == dirSha) {
            ctx.fine('There have been no changes to "$sourceDir" since the last commit');
            return new Future.immediate(true);
          } else {
            gitArgs.addAll(['-p', targetBranchRef.sha]);
            return _doCommit(ctx, 'updated', gitArgs, sourceBranch, sourceDir,
                targetBranch, gitDir);
          }
        });
  }
  
  Future<bool> _doCommit(TaskContext ctx, String verb, List<String> gitArgs,
      String sourceBranch, String sourceDir, String targetBranch, GitDir gitDir) {
  
    return gitDir.getBranchReference(sourceBranch)
        .then((BranchReference branchRef) {
  