private Single<String> getBranch(GitReference ref) {
        String branch = RefUtils.getPath(ref);
        if (branch == null) {
            branch = repo.defaultBranch();
            if (TextUtils.isEmpty(branch)) {
                return ServiceGenerator
                        .createService(context, RepositoryService.class)
                        .getRepository(repo.owner().login(), repo.name())
                        .map(response -> response.body().defaultBranch());
            }
        }

        return Single.just(branch);
    }
Create task to refresh repo's tree

@param repository
@param reference
app/src/main/java/com/github/pockethub/android/core/code/RefreshTreeTask.java