Home Explore Blog CI



git

3rd chunk of `Documentation/git-rev-parse.adoc`
f3c28c32c1939b0d846f7566c8d3cdc61eebbd46fc69cd4e0000000100000fa4
 storage hash algorithm.

Options for Objects
~~~~~~~~~~~~~~~~~~~

--all::
	Show all refs found in `refs/`.

--branches[=<pattern>]::
--tags[=<pattern>]::
--remotes[=<pattern>]::
	Show all branches, tags, or remote-tracking branches,
	respectively (i.e., refs found in `refs/heads`,
	`refs/tags`, or `refs/remotes`, respectively).
+
If a `pattern` is given, only refs matching the given shell glob are
shown.  If the pattern does not contain a globbing character (`?`,
`*`, or `[`), it is turned into a prefix match by appending `/*`.

--glob=<pattern>::
	Show all refs matching the shell glob pattern `pattern`. If
	the pattern does not start with `refs/`, this is automatically
	prepended.  If the pattern does not contain a globbing
	character (`?`, `*`, or `[`), it is turned into a prefix
	match by appending `/*`.

--exclude=<glob-pattern>::
	Do not include refs matching '<glob-pattern>' that the next `--all`,
	`--branches`, `--tags`, `--remotes`, or `--glob` would otherwise
	consider. Repetitions of this option accumulate exclusion patterns
	up to the next `--all`, `--branches`, `--tags`, `--remotes`, or
	`--glob` option (other options or arguments do not clear
	accumulated patterns).
+
The patterns given should not begin with `refs/heads`, `refs/tags`, or
`refs/remotes` when applied to `--branches`, `--tags`, or `--remotes`,
respectively, and they must begin with `refs/` when applied to `--glob`
or `--all`. If a trailing '/{asterisk}' is intended, it must be given
explicitly.

--exclude-hidden=(fetch|receive|uploadpack)::
	Do not include refs that would be hidden by `git-fetch`,
	`git-receive-pack` or `git-upload-pack` by consulting the appropriate
	`fetch.hideRefs`, `receive.hideRefs` or `uploadpack.hideRefs`
	configuration along with `transfer.hideRefs` (see
	linkgit:git-config[1]). This option affects the next pseudo-ref option
	`--all` or `--glob` and is cleared after processing them.

--disambiguate=<prefix>::
	Show every object whose name begins with the given prefix.
	The <prefix> must be at least 4 hexadecimal digits long to
	avoid listing each and every object in the repository by
	mistake.

Options for Files
~~~~~~~~~~~~~~~~~

--local-env-vars::
	List the GIT_* environment variables that are local to the
	repository (e.g. GIT_DIR or GIT_WORK_TREE, but not GIT_EDITOR).
	Only the names of the variables are listed, not their value,
	even if they are set.

--path-format=(absolute|relative)::
	Controls the behavior of certain other options. If specified as absolute, the
	paths printed by those options will be absolute and canonical. If specified as
	relative, the paths will be relative to the current working directory if that
	is possible.  The default is option specific.
+
This option may be specified multiple times and affects only the arguments that
follow it on the command line, either to the end of the command line or the next
instance of this option.

The following options are modified by `--path-format`:

--git-dir::
	Show `$GIT_DIR` if defined. Otherwise show the path to
	the .git directory. The path shown, when relative, is
	relative to the current working directory.
+
If `$GIT_DIR` is not defined and the current directory
is not detected to lie in a Git repository or work tree
print a message to stderr and exit with nonzero status.

--git-common-dir::
	Show `$GIT_COMMON_DIR` if defined, else `$GIT_DIR`.

--resolve-git-dir <path>::
	Check if <path> is a valid repository or a gitfile that
	points at a valid repository, and print the location of the
	repository.  If <path> is a gitfile then the resolved path
	to the real repository is printed.

--git-path <path>::
	Resolve "$GIT_DIR/<path>" and takes other path relocation
	variables such as $GIT_OBJECT_DIRECTORY,
	$GIT_INDEX_FILE... into account. For example, if
	$GIT_OBJECT_DIRECTORY is set to /foo/bar then "git rev-parse
	--git-path objects/abc" returns /foo/bar/abc.

--show-toplevel::
	Show the (by default, absolute) path of the top-level directory
	of the working tree.

Title: Git Rev-Parse Command Options
Summary
The git rev-parse command provides various options for working with objects, files, and repository paths, including options for showing refs, excluding hidden refs, disambiguating object names, listing local environment variables, and controlling path formats, as well as options for resolving git directories and paths.