Options
All
  • Public
  • Public/Protected
  • All
Menu

A simple API with basic functionality of a git repository.

Hierarchy

  • GitRepository

Index

Constructors

  • Initializes a new instance of this class.

    Parameters

    Returns GitRepository

Properties

config?: ProjectConfig

Methods

  • addTag(name: string): Promise<string>
  • Adds a tag to the head of the current branch.

    Parameters

    • name: string

      The name of the tag.

    Returns Promise<string>

    The name of the tag being added.

  • checkout(branchName: string): Promise<void>
  • Checks out a given branch.

    Parameters

    • branchName: string

      Name of the branch to be checked out.

    Returns Promise<void>

  • commit(fileNames: string[], message: string, authorName?: string, authorMail?: string): Promise<string>
  • Adds and commits the given file names to the current branch.

    Parameters

    • fileNames: string[]

      Relative file paths to be added before commit.

    • message: string

      Commit message.

    • Optional authorName: string

      The name of the author.

    • Optional authorMail: string

      Mail address of the author.

    Returns Promise<string>

    The hash of the commit.

  • createOrOpenRepo(): Promise<SimpleGit>
  • Creates or open the test git repository.

    Returns Promise<SimpleGit>

    The instance ot the git repository.

  • ensure(): Promise<void>
  • Ensures the repository exists. If it doesn't exist it will be created.

    Returns Promise<void>

  • ensureNoUnCommitedChanges(): Promise<void>
  • Ensures there are no uncommited changes (staged and unstaged) in the local workspace.

    Returns Promise<void>

  • getConfig(configKey: string): Promise<ConfigGetResult>
  • Gets the git config values.

    Parameters

    • configKey: string

      The key of the config to read.

    Returns Promise<ConfigGetResult>

    The config key-values.

  • getLatestPrereleaseVersion(prereleaseType: GitFlowTagType): Promise<undefined | string>
  • Returns the most recent prerelease of a given type (semantic version).

    Parameters

    Returns Promise<undefined | string>

    The version of the latest release.

  • getLatestPrereleaseVersions(prereleaseType: GitFlowTagType): Promise<string[]>
  • Returns all prereleases of a given type (semantic version).

    Parameters

    Returns Promise<string[]>

    The version of the latest release.

  • getLatestReleasedVersion(): Promise<undefined | string>
  • Returns the most recent released version tag (semantic version).

    Returns Promise<undefined | string>

    The version of the latest release.

  • getLogsSinceLastRelease(): Promise<GitLog[]>
  • Collects all commit messages since the last release.

    Returns Promise<GitLog[]>

    The logs since the last release.

  • getRepoPath(): string
  • Gets the folder path of the git repository.

    Returns string

    The path to the git repository.

  • popLatestStash(): Promise<void>
  • Pops stash with a given name.

    Returns Promise<void>

  • remove(): Promise<void>
  • Gets the path of the git repository.

    Returns Promise<void>

  • stash(): Promise<string>
  • Stashes the uncommited changes from the current branch.

    Returns Promise<string>

    The message of the stashing.

  • status(): Promise<StatusResult>
  • Retrieves the current status of the git repository.

    Returns Promise<StatusResult>

    The status of the git repository.