public Single<FullTree> refresh() {
        GitService gitService = ServiceGenerator.createService(context, GitService.class);

        return getBranch(reference)
                .map(branch -> branch.replace("heads/", ""))
                .flatMap(branch -> getValidRef(gitService, reference, branch))
                .flatMap(reference ->
                        gitService.getGitCommit(repo.owner().login(), repo.name(),
                                reference.object().sha())
                                .map(Response::body)
                                .zipWith(Single.just(reference), RefreshTreeModel::new))
                .flatMap(model ->
                        gitService.getGitTreeRecursive(repo.owner().login(),
                                repo.name(), model.getCommit().tree().sha())
                                .map(Response::body)
                                .zipWith(Single.just(model.ref), FullTree::new));
    }
Create task to refresh repo's tree

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