code: public String refresh(String label) {
  		Git git = null;
  		try {
  			git = createGitClient();
  			if (shouldPull(git)) {
  				FetchResult fetchStatus = fetch(git, label);
  				if (this.deleteUntrackedBranches && fetchStatus != null) {
  					deleteUntrackedLocalBranches(fetchStatus.getTrackingRefUpdates(),
  							git);
  				}
  				// checkout after fetch so we can get any new branches, tags, ect.
  				checkout(git, label);
  				tryMerge(git, label);
  			}
  			else {
  				// nothing to update so just checkout and merge.
  				// Merge because remote branch could have been updated before
  				checkout(git, label);
  				tryMerge(git, label);
  			}
  			// always return what is currently HEAD as the version
  			return git.getRepository().findRef("HEAD").getObjectId().getName();
  		}
  		catch (RefNotFoundException e) {
  			throw new NoSuchLabelException("No such label: " + label, e);
  		}
  		catch (NoRemoteRepositoryException e) {
  			throw new NoSuchRepositoryException("No such repository: " + getUri(), e);
  		}
  		catch (GitAPIException e) {
  			throw new NoSuchRepositoryException(
  					"Cannot clone or checkout repository: " + getUri(), e);
  		}
  		catch (Exception e) {
  			throw new IllegalStateException("Cannot load environment", e);
  		}
  		finally {
  			try {
  				if (git != null) {
  					git.close();
  				}
  			}
  			catch (Exception e) {
  				this.logger.warn("Could not close git repository", e);
  			}
  		}
  	}
docs: Get the working directory ready.
  @param label label to refresh
  @return head id