public interface


implements Scm

Class Overview

Provides functionality for interacting with Git repositories, exposing factories which can be used to retrieve ready-built commands for performing well-known operations as well as a builder factory which can be used to assemble custom commands.

Where possible, plugin developers are strongly encouraged to use top-level services to interface with the SCM, rather than coding directly to the SCM tier. Using the top-level services provides better support for multiple SCMs, as well as providing additional functionality to augment what the SCMs provide. In general, most of the functionality provided by the Git SCM is better accessed via the following services:

  • com.atlassian.bitbucket.commit.CommitService CommitService
  • CompareService
  • com.atlassian.bitbucket.content.ContentService ContentService
  • com.atlassian.bitbucket.pull.PullRequestService PullRequestService
  • com.atlassian.bitbucket.repository.RefService RefService
  • com.atlassian.bitbucket.repository.RepositoryService RepositoryService
when coding directly to the Git SCM, plugin developers should always check the repository's SCM ID on the repository before attempting to run Git commands against it.


String ID
String NAME
Public Methods
@Nonnull GitBulkContentCommandFactory getBulkContentCommandFactory()
@Nonnull GitCommandBuilderFactory getCommandBuilderFactory()
@Nonnull GitCommandFactory getCommandFactory()
@Nonnull GitCompareCommandFactory getCompareCommandFactory()
@Nonnull GitExtendedCommandFactory getExtendedCommandFactory()
@Nonnull GitIntegrityCheckCommandFactory getIntegrityCheckCommandFactory()
@Nonnull PluginMergeStrategies getMergeStrategies()
@Nonnull Version getMinimumVersion()
@Nonnull GitPullRequestCommandFactory getPullRequestCommandFactory()
@Nonnull GitRefCommandFactory getRefCommandFactory()
@Nonnull Optional<Version> getVersion()
Retrieves the git version, if an acceptable version was found.
Inherited Methods
From interface com.atlassian.bitbucket.scm.Scm


public static final String ID

Constant Value: "git"

public static final String NAME

Constant Value: "Git"

Public Methods

@Nonnull public GitBulkContentCommandFactory getBulkContentCommandFactory ()

  • a command factory providing support for bulk operations

@Nonnull public GitCommandBuilderFactory getCommandBuilderFactory ()

  • a factory for creating builders, used to assemble custom commands using either free-form arguments or type-safe wrappers around git commands like diff and rev-list

@Nonnull public GitCommandFactory getCommandFactory ()

  • a command factory providing standard SCM functionality, like the ability to list branches or diff two commits

@Nonnull public GitCompareCommandFactory getCompareCommandFactory ()

  • a command factory for comparing refs within and between repositories

@Nonnull public GitExtendedCommandFactory getExtendedCommandFactory ()

  • a command factory providing extended SCM functionality

@Nonnull public GitIntegrityCheckCommandFactory getIntegrityCheckCommandFactory ()

  • a command factory to perform integrity checks

@Nonnull public PluginMergeStrategies getMergeStrategies ()

  • a set of merge strategies supported by the Git SCM

@Nonnull public Version getMinimumVersion ()

  • the minimum supported git version.

@Nonnull public GitPullRequestCommandFactory getPullRequestCommandFactory ()

  • a command factory for displaying and merging pull requests within and between repositories

@Nonnull public GitRefCommandFactory getRefCommandFactory ()

  • a command factory for mutating refs

@Nonnull public Optional<Version> getVersion ()

Retrieves the git version, if an acceptable version was found. If git was not found, or is not an acceptable version, empty() is returned.

  • the git version, or empty() if git was not found or was not an acceptable version