Dagger
Search

git

This module has been generated via dagger init and serves as a reference to
basic module structure as you get started with Dagger.

Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate usage of arguments and return types using simple
echo and grep commands. The functions can be called from the dagger CLI or
from one of the SDKs.

The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.

Installation

dagger install github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005

Entrypoint

Return Type
Git !
Arguments
NameTypeDefault ValueDescription
sourceDirectory -Git repository directory (must include .git)
imageRegistryString "docker.io"Git image registry
imageRepositoryString "alpine/git"Git image repositroy
imageTagString "2.52.0"Git image tag
userIdString "65532"Git image user
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
func (m *MyModule) Example() *dagger.Git  {
	return dag.
			Git()
}
@function
def example() -> dagger.Git:
	return (
		dag.git()
	)
@func()
example(): Git {
	return dag
		.git()
}

Types

Git 🔗

container() 🔗

Creates container with configured git

Return Type
Container !
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 container
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Git().
			Container()
}
@function
def example() -> dagger.Container:
	return (
		dag.git()
		.container()
	)
@func()
example(): Container {
	return dag
		.git()
		.container()
}

createTag() 🔗

Create a local lightweight or annotated tag.

Return Type
Git !
Arguments
NameTypeDefault ValueDescription
tagString !-Tag name to create
messageString nullOptional annotated tag message
userNameString !"dagger-ci"Tagger name for annotated tags
userEmailString !"dagger-ci@example.local"Tagger email for annotated tags
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 create-tag --tag string --user-name string --user-email string
func (m *MyModule) Example(tag string, userName string, userEmail string) *dagger.Git  {
	return dag.
			Git().
			CreateTag(tag, userName, userEmail)
}
@function
def example(tag: str, user_name: str, user_email: str) -> dagger.Git:
	return (
		dag.git()
		.create_tag(tag, user_name, user_email)
	)
@func()
example(tag: string, userName: string, userEmail: string): Git {
	return dag
		.git()
		.createTag(tag, userName, userEmail)
}

ensureRef() 🔗

Resolve a ref or fail with a clear missing-ref error.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
refString !-Git ref or SHA to resolve
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 ensure-ref --ref string
func (m *MyModule) Example(ctx context.Context, ref string) string  {
	return dag.
			Git().
			EnsureRef(ctx, ref)
}
@function
async def example(ref: str) -> str:
	return await (
		dag.git()
		.ensure_ref(ref)
	)
@func()
async example(ref: string): Promise<string> {
	return dag
		.git()
		.ensureRef(ref)
}

getChangedComponents() 🔗

Return discovered components whose files changed between two refs.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !-Head Git ref or SHA
componentRoots[String ! ] !-Component root directories or glob-like patterns
sharedPaths[String ! ] nullPaths that affect all components
singleComponentBoolean falseTreat repository as one component
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-changed-components --base-ref string --head-ref string --component-roots string1 --component-roots string2
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string, componentRoots []string) []string  {
	return dag.
			Git().
			GetChangedComponents(ctx, baseRef, headRef, componentRoots)
}
@function
async def example(base_ref: str, head_ref: str, component_roots: List[str]) -> List[str]:
	return await (
		dag.git()
		.get_changed_components(base_ref, head_ref, component_roots)
	)
@func()
async example(baseRef: string, headRef: string, componentRoots: string[]): Promise<string[]> {
	return dag
		.git()
		.getChangedComponents(baseRef, headRef, componentRoots)
}

getChangedDirs() 🔗

Return unique changed directories between two refs.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !-Head Git ref or SHA
paths[String ! ] nullOptional path filters relative to the repository root
depthInteger !1Directory depth to return
diffFilterString !"ACMRTUXB"Git diff-filter status letters
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-changed-dirs --base-ref string --head-ref string --depth integer --diff-filter string
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string, depth int, diffFilter string) []string  {
	return dag.
			Git().
			GetChangedDirs(ctx, baseRef, headRef, depth, diffFilter)
}
@function
async def example(base_ref: str, head_ref: str, depth: int, diff_filter: str) -> List[str]:
	return await (
		dag.git()
		.get_changed_dirs(base_ref, head_ref, depth, diff_filter)
	)
@func()
async example(baseRef: string, headRef: string, depth: number, diffFilter: string): Promise<string[]> {
	return dag
		.git()
		.getChangedDirs(baseRef, headRef, depth, diffFilter)
}

getChangedDirsSinceMergeBase() 🔗

Return unique changed directories from the merge base of base_ref and head_ref to head_ref.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !"HEAD"Head Git ref or SHA
paths[String ! ] nullOptional path filters relative to the repository root
depthInteger !1Directory depth to return
diffFilterString !"ACMRTUXB"Git diff-filter status letters
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-changed-dirs-since-merge-base --base-ref string --head-ref string --depth integer --diff-filter string
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string, depth int, diffFilter string) []string  {
	return dag.
			Git().
			GetChangedDirsSinceMergeBase(ctx, baseRef, headRef, depth, diffFilter)
}
@function
async def example(base_ref: str, head_ref: str, depth: int, diff_filter: str) -> List[str]:
	return await (
		dag.git()
		.get_changed_dirs_since_merge_base(base_ref, head_ref, depth, diff_filter)
	)
@func()
async example(baseRef: string, headRef: string, depth: number, diffFilter: string): Promise<string[]> {
	return dag
		.git()
		.getChangedDirsSinceMergeBase(baseRef, headRef, depth, diffFilter)
}

getChangedFiles() 🔗

Return changed file paths between two refs.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !-Head Git ref or SHA
paths[String ! ] nullOptional path filters relative to the repository root
diffFilterString !"ACMRTUXB"Git diff-filter status letters
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-changed-files --base-ref string --head-ref string --diff-filter string
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string, diffFilter string) []string  {
	return dag.
			Git().
			GetChangedFiles(ctx, baseRef, headRef, diffFilter)
}
@function
async def example(base_ref: str, head_ref: str, diff_filter: str) -> List[str]:
	return await (
		dag.git()
		.get_changed_files(base_ref, head_ref, diff_filter)
	)
@func()
async example(baseRef: string, headRef: string, diffFilter: string): Promise<string[]> {
	return dag
		.git()
		.getChangedFiles(baseRef, headRef, diffFilter)
}

getChangedFilesSinceMergeBase() 🔗

Return changed file paths from the merge base of base_ref and head_ref to head_ref.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !"HEAD"Head Git ref or SHA
paths[String ! ] nullOptional path filters relative to the repository root
diffFilterString !"ACMRTUXB"Git diff-filter status letters
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-changed-files-since-merge-base --base-ref string --head-ref string --diff-filter string
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string, diffFilter string) []string  {
	return dag.
			Git().
			GetChangedFilesSinceMergeBase(ctx, baseRef, headRef, diffFilter)
}
@function
async def example(base_ref: str, head_ref: str, diff_filter: str) -> List[str]:
	return await (
		dag.git()
		.get_changed_files_since_merge_base(base_ref, head_ref, diff_filter)
	)
@func()
async example(baseRef: string, headRef: string, diffFilter: string): Promise<string[]> {
	return dag
		.git()
		.getChangedFilesSinceMergeBase(baseRef, headRef, diffFilter)
}

getChangedPaths() 🔗

Return changed paths inside diff_path between target_branch and HEAD

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
targetBranchString !"master"Target branch or ref to diff against
diffPathString "."Path to scope the diff (relative to repo root)
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-changed-paths --target-branch string
func (m *MyModule) Example(ctx context.Context, targetBranch string) []string  {
	return dag.
			Git().
			GetChangedPaths(ctx, targetBranch)
}
@function
async def example(target_branch: str) -> List[str]:
	return await (
		dag.git()
		.get_changed_paths(target_branch)
	)
@func()
async example(targetBranch: string): Promise<string[]> {
	return dag
		.git()
		.getChangedPaths(targetBranch)
}

getComponents() 🔗

Return discovered component roots in stable sorted order.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
componentRoots[String ! ] !-Component root directories or glob-like patterns
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-components --component-roots string1 --component-roots string2
func (m *MyModule) Example(ctx context.Context, componentRoots []string) []string  {
	return dag.
			Git().
			GetComponents(ctx, componentRoots)
}
@function
async def example(component_roots: List[str]) -> List[str]:
	return await (
		dag.git()
		.get_components(component_roots)
	)
@func()
async example(componentRoots: string[]): Promise<string[]> {
	return dag
		.git()
		.getComponents(componentRoots)
}

getLatestTag() 🔗

Return the latest matching tag, or an empty string when none match.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
patternString !"*"Optional tag filter pattern (glob)
semverBoolean trueOnly consider semantic version tags
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-latest-tag --pattern string
func (m *MyModule) Example(ctx context.Context, pattern string) string  {
	return dag.
			Git().
			GetLatestTag(ctx, pattern)
}
@function
async def example(pattern: str) -> str:
	return await (
		dag.git()
		.get_latest_tag(pattern)
	)
@func()
async example(pattern: string): Promise<string> {
	return dag
		.git()
		.getLatestTag(pattern)
}

getMergeBase() 🔗

Return the merge-base commit shared by two refs.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !-Head Git ref or SHA
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-merge-base --base-ref string --head-ref string
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string) string  {
	return dag.
			Git().
			GetMergeBase(ctx, baseRef, headRef)
}
@function
async def example(base_ref: str, head_ref: str) -> str:
	return await (
		dag.git()
		.get_merge_base(base_ref, head_ref)
	)
@func()
async example(baseRef: string, headRef: string): Promise<string> {
	return dag
		.git()
		.getMergeBase(baseRef, headRef)
}

getShortCommitSha() 🔗

Return short commit SHA for HEAD

Return Type
String !
Arguments
NameTypeDefault ValueDescription
lengthInteger 8Length of the short SHA
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-short-commit-sha
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Git().
			GetShortCommitSha(ctx)
}
@function
async def example() -> str:
	return await (
		dag.git()
		.get_short_commit_sha()
	)
@func()
async example(): Promise<string> {
	return dag
		.git()
		.getShortCommitSha()
}

getTags() 🔗

Return tags in the repository, optionally filtered by glob pattern.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
patternString !"*"Optional tag filter pattern (glob)
sortString !"version"Tag sort key: version, refname, or any git tag sort key
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-tags --pattern string --sort string
func (m *MyModule) Example(ctx context.Context, pattern string, sort string) []string  {
	return dag.
			Git().
			GetTags(ctx, pattern, sort)
}
@function
async def example(pattern: str, sort: str) -> List[str]:
	return await (
		dag.git()
		.get_tags(pattern, sort)
	)
@func()
async example(pattern: string, sort: string): Promise<string[]> {
	return dag
		.git()
		.getTags(pattern, sort)
}

getTagsPointingAt() 🔗

Return tags that point at a ref.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
refString !"HEAD"Git ref to inspect
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 get-tags-pointing-at --ref string
func (m *MyModule) Example(ctx context.Context, ref string) []string  {
	return dag.
			Git().
			GetTagsPointingAt(ctx, ref)
}
@function
async def example(ref: str) -> List[str]:
	return await (
		dag.git()
		.get_tags_pointing_at(ref)
	)
@func()
async example(ref: string): Promise<string[]> {
	return dag
		.git()
		.getTagsPointingAt(ref)
}

hasChanges() 🔗

Return whether any files changed between two refs.

Return Type
Boolean !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !-Head Git ref or SHA
paths[String ! ] nullOptional path filters relative to the repository root
diffFilterString !"ACMRTUXB"Git diff-filter status letters
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 has-changes --base-ref string --head-ref string --diff-filter string
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string, diffFilter string) bool  {
	return dag.
			Git().
			HasChanges(ctx, baseRef, headRef, diffFilter)
}
@function
async def example(base_ref: str, head_ref: str, diff_filter: str) -> bool:
	return await (
		dag.git()
		.has_changes(base_ref, head_ref, diff_filter)
	)
@func()
async example(baseRef: string, headRef: string, diffFilter: string): Promise<boolean> {
	return dag
		.git()
		.hasChanges(baseRef, headRef, diffFilter)
}

hasTag() 🔗

Return whether a tag exists in the repository.

Return Type
Boolean !
Arguments
NameTypeDefault ValueDescription
tagString !-Tag name to check
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 has-tag --tag string
func (m *MyModule) Example(ctx context.Context, tag string) bool  {
	return dag.
			Git().
			HasTag(ctx, tag)
}
@function
async def example(tag: str) -> bool:
	return await (
		dag.git()
		.has_tag(tag)
	)
@func()
async example(tag: string): Promise<boolean> {
	return dag
		.git()
		.hasTag(tag)
}

pushTag() 🔗

Push a local tag to a remote.

Return Type
Git !
Arguments
NameTypeDefault ValueDescription
tagString !-Tag name to push
remoteString !"origin"Remote name to push the tag to
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 push-tag --tag string --remote string
func (m *MyModule) Example(tag string, remote string) *dagger.Git  {
	return dag.
			Git().
			PushTag(tag, remote)
}
@function
def example(tag: str, remote: str) -> dagger.Git:
	return (
		dag.git()
		.push_tag(tag, remote)
	)
@func()
example(tag: string, remote: string): Git {
	return dag
		.git()
		.pushTag(tag, remote)
}

withFetchedRefs() 🔗

Fetch refs from remote and keep them available for later Git calls.

Return Type
Git !
Arguments
NameTypeDefault ValueDescription
remoteString !"origin"Remote name to fetch refs from
refspecs[String ! ] nullOptional refspecs to fetch
depthInteger nullOptional shallow fetch depth
pruneBoolean falsePrune deleted remote-tracking refs
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 with-fetched-refs --remote string
func (m *MyModule) Example(remote string) *dagger.Git  {
	return dag.
			Git().
			WithFetchedRefs(remote)
}
@function
def example(remote: str) -> dagger.Git:
	return (
		dag.git()
		.with_fetched_refs(remote)
	)
@func()
example(remote: string): Git {
	return dag
		.git()
		.withFetchedRefs(remote)
}

withFetchedTags() 🔗

Fetch tags from remote.

Return Type
Git !
Arguments
NameTypeDefault ValueDescription
remoteString !"origin"Remote name to fetch tags from
pruneBoolean falsePrune deleted tags
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 with-fetched-tags --remote string
func (m *MyModule) Example(remote string) *dagger.Git  {
	return dag.
			Git().
			WithFetchedTags(remote)
}
@function
def example(remote: str) -> dagger.Git:
	return (
		dag.git()
		.with_fetched_tags(remote)
	)
@func()
example(remote: string): Git {
	return dag
		.git()
		.withFetchedTags(remote)
}

withHttpsTokenAuth() 🔗

Configure HTTPS token authentication for Git operations.

Return Type
Git !
Arguments
NameTypeDefault ValueDescription
hostString !-HTTPS Git host to authenticate against
tokenSecret !-HTTPS token secret
usernameString nullOptional HTTPS username
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 with-https-token-auth --host string --token env:MYSECRET
func (m *MyModule) Example(host string, token *dagger.Secret) *dagger.Git  {
	return dag.
			Git().
			WithHttpsTokenAuth(host, token)
}
@function
def example(host: str, token: dagger.Secret) -> dagger.Git:
	return (
		dag.git()
		.with_https_token_auth(host, token)
	)
@func()
example(host: string, token: Secret): Git {
	return dag
		.git()
		.withHttpsTokenAuth(host, token)
}

withSshKeyAuth() 🔗

Configure SSH key authentication for Git operations.

Return Type
Git !
Arguments
NameTypeDefault ValueDescription
privateKeySecret !-SSH private key secret
knownHostsSecret !-SSH known_hosts secret
hostString nullOptional SSH Git host to configure
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 with-ssh-key-auth --private-key env:MYSECRET --known-hosts env:MYSECRET
func (m *MyModule) Example(privateKey *dagger.Secret, knownHosts *dagger.Secret) *dagger.Git  {
	return dag.
			Git().
			WithSshKeyAuth(privateKey, knownHosts)
}
@function
def example(private_key: dagger.Secret, known_hosts: dagger.Secret) -> dagger.Git:
	return (
		dag.git()
		.with_ssh_key_auth(private_key, known_hosts)
	)
@func()
example(privateKey: Secret, knownHosts: Secret): Git {
	return dag
		.git()
		.withSshKeyAuth(privateKey, knownHosts)
}

withUnshallow() 🔗

Ensure a shallow repository has full history for later Git calls.

Return Type
Git !
Arguments
NameTypeDefault ValueDescription
remoteString !"origin"Remote name to fetch full history from
Example
dagger -m github.com/riftonix/daggerverse/modules/git@a3f1d25e2ca4842e9141895f2cd2649647a3a005 call \
 with-unshallow --remote string
func (m *MyModule) Example(remote string) *dagger.Git  {
	return dag.
			Git().
			WithUnshallow(remote)
}
@function
def example(remote: str) -> dagger.Git:
	return (
		dag.git()
		.with_unshallow(remote)
	)
@func()
example(remote: string): Git {
	return dag
		.git()
		.withUnshallow(remote)
}