code: private String getUnqualifiedBranch(String qualifiedBranch) {
      	String branchName = qualifiedBranch;
      	Pattern pattern = Pattern.compile("(refs/)?remotes/[^/]+/(.*)|(origin[0-9]*/)?(.*)");
      	Matcher matcher = pattern.matcher(branchName);
      	if(matcher.matches()) {
      		if (matcher.group(2) != null) {
      			branchName = matcher.group(2);
      		} else if (matcher.group(4) != null) {
      			branchName = matcher.group(4);
      		}
      	}
      	return branchName;
      }
docs: Gets the unqualified branch name given the qualified one of the following forms:
  1. refs/remotes/<remote name>/<branch name>
  2. remotes/<remote name>/<branch name>
  3. origin/<branch name>
  4. <branch name>
  @param qualifiedBranch
  @return the unqualified branch name