class GitPathUtil {

    public static Optional<String> extractBranchFromRef(final String refName) {
        final Matcher matcher = branchNameExtractorFromRef.matcher(refName);
        if (matcher.matches()) {
            return Optional.of(matcher.group(1));
        } else {
            return Optional.empty();
        }
    }

}