class Git::Commands::ShowRef::ExcludeExisting

Stdin filter mode for ‘git show-ref –exclude-existing`

Reads ref names from the positional arguments, passes them to git’s stdin, and outputs only those refs that do NOT already exist in the local repository. Useful for determining which remote refs would be new if fetched.

Pass ‘exclude_existing: ’refs/heads/‘` to limit filtering to refs matching the given prefix pattern. By default (no pattern), all refs are evaluated.

For standard ref listing, use {Git::Commands::ShowRef::List}. For strict per-ref verification, use {Git::Commands::ShowRef::Verify}. For a boolean existence check (git >= 2.43), use {Git::Commands::ShowRef::Exists}.

@example Filter refs that do not exist locally

cmd = Git::Commands::ShowRef::ExcludeExisting.new(execution_context)
result = cmd.call('refs/heads/main', 'refs/heads/feature')
result.stdout  # => "abc1234 refs/heads/feature\n"

@example Limit filtering to a prefix pattern

cmd = Git::Commands::ShowRef::ExcludeExisting.new(execution_context)
result = cmd.call('refs/heads/main', exclude_existing: 'refs/heads/')
# refs/heads/main already exists locally, so git echoes nothing
result.stdout  # => ""

@note ‘arguments` block audited against git-scm.com/docs/git-show-ref/2.53.0

@see Git::Commands::ShowRef

@see git-scm.com/docs/git-show-ref git-show-ref documentation

@api private