code: protected void gitFetchRemoteAndCompare(final String branchName)
              throws MojoFailureException, CommandLineException {
          if (gitFetchRemote(branchName)) {
              getLog().info(
                      "Comparing local branch '" + branchName + "' with remote '"
                              + gitFlowConfig.getOrigin() + "/" + branchName
                              + "'.");
              String revlistout = executeGitCommandReturn("rev-list",
                      "--left-right", "--count", branchName + "..."
                              + gitFlowConfig.getOrigin() + "/" + branchName);
  
              String[] counts = org.apache.commons.lang3.StringUtils.split(
                      revlistout, '\t');
              if (counts != null && counts.length > 1) {
                  if (!"0".equals(org.apache.commons.lang3.StringUtils
                          .deleteWhitespace(counts[1]))) {
                      throw new MojoFailureException("Remote branch '"
                              + gitFlowConfig.getOrigin() + "/" + branchName
                              + "' is ahead of the local branch '" + branchName
                              + "'. Execute git pull.");
                  }
              }
          }
      }
docs: Executes git fetch and compares local branch with the remote.
  
  @param branchName
  Branch name to fetch and compare.
  @throws MojoFailureException
  @throws CommandLineException