code: public boolean isLocalBranch(final Git git, final String branch) {
          try {
              final List<Ref> refs = git.branchList().call();
              return refs.stream()
                  .anyMatch(ref -> ref.getName().endsWith(branch));
          } catch (GitAPIException e) {
              throw new IllegalStateException(e);
          }
      }
docs: Checks if given branch has been checkedout locally too.
  
  @param git
  instance.
  @param branch
  to check.
  
  @return True if it is local, false otherwise.