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>
getCommits({required String root, String? fromRef, String? toRef}) Future<List<Commit>>
Gets the commits between two refs If fromRef is null, it gets all commits up to toRef (or HEAD if toRef is 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>
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)>>
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