Skip to content
Back to top
View this page

# semantic_release.gitproject module

Module for git related operations.

class semantic_release.gitproject.GitProject(directory: Path | str = '.', commit_author: Actor | None = None, credential_masker: MaskingFilter | None = None)

  Bases: `object`

  git_add(paths: Sequence[Path | str], force: bool = False, strict: bool = False, noop: bool = False) → None
  git_commit(message: str, date: int | None = None, commit_all: bool = False, no_verify: bool = False, noop: bool = False) → None
  git_push_branch(remote_url: str, branch: str, noop: bool = False) → None
  git_push_tag(remote_url: str, tag: str, noop: bool = False, force: bool = False) → None
  git_tag(tag_name: str, message: str, isotimestamp: str, force: bool = False, noop: bool = False) → None
  git_unshallow(noop: bool = False) → None

    Convert a shallow clone to a full clone by fetching the full history.

    Parameters:

      noop – Whether or not to actually run the unshallow command

  is_dirty() → bool
  is_shallow_clone() → bool

    Check if the repository is a shallow clone.

    Returns:

      True if the repository is a shallow clone, False otherwise

  property logger: Logger
  property project_root: Path
  verify_upstream_unchanged(local_ref: str = 'HEAD', upstream_ref: str = 'origin', remote_url: str | None = None, noop: bool = False) → None

    Verify that the upstream branch has not changed since the given local reference.

    Parameters:

      - local_ref – The local reference to compare against upstream (default: HEAD)

      - upstream_ref – The name of the upstream remote or specific remote branch (default: origin)

      - remote_url – Optional authenticated remote URL to use for fetching (default: None, uses configured remote)

      - noop – Whether to skip the actual verification (for dry-run mode)

    Raises:

      UpstreamBranchChangedError – If the upstream branch has changed