GitUtils class
Utility functions for Git operations
Constructors
- GitUtils()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
buildCompareUrl(
String? remoteUrl, String? baseRef, String? newRef, String filePath) → String? - Builds a comparison URL for a file between two refs
-
checkoutRef(
String ref, String? root) → Future< void> - Checks out a specific git ref Throws GitException if the operation fails
-
commitVersion(
String version, String? root, {bool? commitBadge, bool commitChangelog = true}) → Future< void> -
createWorktree(
String gitRoot, String ref, String worktreePath) → Future< void> - Creates a git worktree at the specified path for the given ref Throws GitException if the operation fails
-
getCommits(
{required String root, String? fromRef, String? toRef}) → Future< List< Commit> > -
Gets the commits between two refs
If
fromRefis null, it gets all commits up totoRef(or HEAD iftoRefis null) -
getCommitsSinceLastTag(
String root, String currentVersion) → Future< List< Commit> > - Gets the commits since the last version tag If the latest tag matches the current version (e.g. CI running on tagged commit), it gets the commits since the previous tag. If they do not match (e.g. preparing for a new release), it gets commits since the latest tag.
-
getCurrentBranch(
String? root) → Future< String?> - Gets the current Git branch name Returns null if in detached HEAD state or throws GitException if there's an error.
-
getCurrentCommitHash(
String? root) → Future< String?> - Gets the current commit hash
-
getCurrentRef(
String? root) → Future< String> - Gets the current HEAD ref
-
getCurrentWorkingDirectory(
) → String - Gets the current working directory path
-
getPreviousRef(
String? root, {String tagPrefix = 'v'}) → Future< String> -
getPreviousRefForPackage(
String? root, String packageName, {String tagPrefix = 'v'}) → Future< String?> - Gets the previous tag ref for a specific package in a workspace Returns null if no tags exist for the package
-
getRemoteUrl(
String? root) → Future< String?> - Gets the remote URL of the git repository
-
getRepositoryRoot(
String? root) → String - Gets the repository root directory
-
getTags(
String? root) → Future< List< String> > -
getVersions(
String? root, {String tagPrefix = 'v'}) → Future< List< (String, Version)> > -
getVersionsForPackage(
String? root, String packageName, {String tagPrefix = 'v'}) → Future< List< (String, Version)> > - Gets version tags for a specific package in a workspace Tags are expected to be in format: {package-name}/v{version}
-
gitShow(
String ref, String? root, String path) → Future< String> -
gitTag(
String tag, String? root) → Future< void> -
gitTagExists(
String tag, String? root) → Future< bool> -
hasUncommittedChanges(
String? root) → bool - Checks if the current repository has uncommitted changes Throws GitException if Git is not available or if there's an error.
-
isGitRepository(
String? root) → Future< bool> - Checks if the current directory is a Git repository
-
listWorktrees(
String gitRoot) → Future< List< String> > - Lists all worktrees for the repository Returns a list of worktree paths
-
removeWorktree(
String gitRoot, String worktreePath) → Future< void> - Removes a git worktree Throws GitException if the operation fails
-
resolveRef(
String ref, String? root) → Future< String> - Resolves a git ref to its commit hash Throws GitException if the ref doesn't exist
-
worktreeExists(
String gitRoot, String worktreePath) → Future< bool> - Checks if a worktree exists at the specified path