GIT(1)
๐ GIT(1) ๐
Git Manual energy, bestie โ we're literally in it. This page is GIT(1), and it's about to explain the whole vibe.
๐ NAME ๐
git โ the stupid content tracker ๐
โจ SYNOPSIS โจ
git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch]
[--no-optional-locks] [--no-advice] [--bare] [--git-dir=<path>]
[--work-tree=<path>] [--namespace=<name>] [--config-env=<name>=<envvar>]
<command> [<args>]
๐ฆ DESCRIPTION ๐ฆ
Okay so Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. It's giving powerhouse, honestly.
See gittutorial(7) to get started, then see giteveryday(7) for a useful minimum set of commands. The Git Userโs Manual[1] has a more in-depth introduction. See gitdatamodel(7) if you want to learn about the data model and important terminology. iykyk โ the data model is lowkey the main character.
After you mastered the basic concepts, you can come back to this page to learn what commands Git offers. You can learn more about individual Git commands with git help command. gitcli(7) manual page gives you an overview of the command-line command syntax. Slay.
A formatted and hyperlinked copy of the latest Git documentation can be viewed at https://git.github.io/htmldocs/git.html or https://git-scm.com/docs. Bookmark it, bestie ๐ซถ
๐ OPTIONS ๐
-v,--versionโ Prints the Git suite version that thegitprogram came from. ๐ท๏ธ
This option is internally converted to git version ... and accepts the same options as the git-version(1) command. If --help is also given, it takes precedence over --version. Not me getting overruled by help ๐ญ
-h,--helpโ Prints the synopsis and a list of the most commonly used commands. If the option--allor-ais given then all available commands are printed. If a Git command is named this option will bring up the manual page for that command. ๐ซถ
Other options are available to control how the manual page is displayed. See git-help(1) for more information, because git --help ... is converted internally into git help ....
-C <path>โ Run as ifgitwas started in<path>instead of the current working directory. When multiple-Coptions are given, each subsequent non-absolute-C <path>is interpreted relative to the preceding-C <path>. If<path>is present but empty, e.g.-C "", then the current working directory is left unchanged. ๐
This option affects options that expect path name like --git-dir and --work-tree in that their interpretations of the path names would be made relative to the working directory caused by the -C option. For example the following invocations are equivalent:
git --git-dir=a.git --work-tree=b -C c status
git --git-dir=c/a.git --work-tree=c/b status
-c <name>=<value>โ Pass a configuration parameter to the command. The value given will override values from configuration files. The<name>is expected in the same format as listed bygit config(subkeys separated by dots). โ๏ธ
Note that omitting the = in git -c foo.bar ... is allowed and sets foo.bar to the boolean true value (just like [foo]bar would in a config file). Including the equals but with an empty value (like git -c foo.bar= ...) sets foo.bar to the empty string which git config --type=bool will convert to false. The way that's so specific ๐ญ
--config-env=<name>=<envvar>โ Like-c <name>=<value>, give configuration variable<name>a value, where<envvar>is the name of an environment variable from which to retrieve the value. Unlike-cthere is no shortcut for directly setting the value to an empty string, instead the environment variable itself must be set to the empty string. It is an error if the<envvar>does not exist in the environment.<envvar>may not contain an equals sign to avoid ambiguity with<name>containing one. ๐
This is useful for cases where you want to pass transitory configuration options to git, but are doing so on operating systems where other processes might be able to read your command line (e.g. /proc/self/cmdline), but not your environment (e.g. /proc/self/environ). That behavior is the default on Linux, but may not be on your system.
Note that this might add security for variables such as http.extraHeader where the sensitive information is part of the value, but not e.g. url.<base>.insteadOf where the sensitive information can be part of the key. Important distinction, bestie ๐
--exec-path[=<path>]โ Path to wherever your core Git programs are installed. This can also be controlled by setting theGIT_EXEC_PATHenvironment variable. If no path is given,gitwill print the current setting and then exit. ๐--html-pathโ Print the path, without trailing slash, where Gitโs HTML documentation is installed and exit. ๐--man-pathโ Print the manpath (seeman(1)) for the man pages for this version of Git and exit. ๐--info-pathโ Print the path where the Info files documenting this version of Git are installed and exit. ๐๏ธ-p,--paginateโ Pipe all output intoless(or if set,$PAGER) if standard output is a terminal. This overrides thepager.<cmd>configuration options (see the "Configuration Mechanism" section below). ๐-P,--no-pagerโ Do not pipe Git output into a pager. No scrolling era, periodt.--git-dir=<path>โ Set the path to the repository (".git"directory). This can also be controlled by setting theGIT_DIRenvironment variable. It can be an absolute path or relative path to current working directory. ๐
Specifying the location of the ".git" directory using this option (or GIT_DIR environment variable) turns off the repository discovery that tries to find a directory with ".git" subdirectory (which is how the repository and the top-level of the working tree are discovered), and tells Git that you are at the top level of the working tree. If you are not at the top-level directory of the working tree, you should tell Git where the top-level of the working tree is, with the --work-tree=<path> option (or GIT_WORK_TREE environment variable) ๐ซ
If you just want to run git as if it was started in <path> then use git -C <path>. That's the shortcut, bestie โจ
--work-tree=<path>โ Set the path to the working tree. It can be an absolute path or a path relative to the current working directory. This can also be controlled by setting theGIT_WORK_TREEenvironment variable and thecore.worktreeconfiguration variable (seecore.worktreeingit-config(1)for a more detailed discussion). ๐ณ--namespace=<path>โ Set the Git namespace. Seegitnamespaces(7)for more details. Equivalent to setting theGIT_NAMESPACEenvironment variable. ๐ช--bareโ Treat the repository as a bare repository. IfGIT_DIRenvironment is not set, it is set to the current working directory. ๐งบ--no-replace-objectsโ Do not use replacement refs to replace Git objects. This is equivalent to exporting theGIT_NO_REPLACE_OBJECTSenvironment variable with any value. Seegit-replace(1)for more information. ๐ซ--no-lazy-fetchโ Do not fetch missing objects from the promisor remote on demand. Useful together withgit cat-file -e <object>to see if the object is locally available. This is equivalent to setting theGIT_NO_LAZY_FETCHenvironment variable to1. ๐ค--no-optional-locksโ Do not perform optional operations that require locks. This is equivalent to setting theGIT_OPTIONAL_LOCKSto0. ๐--no-adviceโ Disable all advice hints from being printed. Silence era ๐--literal-pathspecsโ Treat pathspecs literally (i.e. no globbing, no pathspec magic). This is equivalent to setting theGIT_LITERAL_PATHSPECSenvironment variable to1. ๐ค--glob-pathspecsโ Add"glob"magic to all pathspec. This is equivalent to setting theGIT_GLOB_PATHSPECSenvironment variable to1. Disabling globbing on individual pathspecs can be done using pathspec magic":(literal)". ๐--noglob-pathspecsโ Add"literal"magic to all pathspec. This is equivalent to setting theGIT_NOGLOB_PATHSPECSenvironment variable to1. Enabling globbing on individual pathspecs can be done using pathspec magic":(glob)". ๐ง--icase-pathspecsโ Add"icase"magic to all pathspec. This is equivalent to setting theGIT_ICASE_PATHSPECSenvironment variable to1. ๐--list-cmds=<group>[,<group>...]โ List commands by group. This is an internal/experimental option and may change or be removed in the future. Supported groups are:builtins,parseopt(builtin commands that use parse-options),deprecated(deprecated builtins),main(all commands in libexec directory),others(all other commands in$PATHthat have git-prefix),list-<category>(see categories incommand-list.txt),nohelpers(exclude helper commands),aliasandconfig(retrieve command list from config variablecompletion.commands). ๐งช--attr-source=<tree-ish>โ Read gitattributes from<tree-ish>instead of the worktree. Seegitattributes(5). This is equivalent to setting theGIT_ATTR_SOURCEenvironment variable. ๐ธ
๐ GIT COMMANDS ๐
We divide Git into high level ("porcelain") commands and low level ("plumbing") commands. Yes bestie, porcelain and plumbing โ iconic naming, no notes.
For defining command aliases, see git-config(1) and look for descriptions of alias.*. For installing custom "git" subcommands, see the description for the PATH environment variable in this manual. ๐
โจ HIGH-LEVEL COMMANDS (PORCELAIN) โจ
Okay so the porcelain commands are the ones you actually touch day to day, and Git splits them into the main girlies ๐ and a bunch of ancillary little helper utilities that do the side-quests. Let's get into it bestie, no cap.
๐ธ Main porcelain commands ๐ธ
These are the icons. The main characters. The ones you'll type a thousand times before you graduate:
git-add(1)โ Add file contents to the index. (aka "babe, this goes in the staging area now")git-am(1)โ Apply a series of patches from a mailbox.git-archive(1)โ Create an archive of files from a named tree.git-backfill(1)โ Download missing objects in a partial clone.git-bisect(1)โ Use binary search to find the commit that introduced a bug. Detective mode fr ๐git-branch(1)โ List, create, or delete branches.git-bundle(1)โ Move objects and refs by archive.git-checkout(1)โ Switch branches or restore working tree files.git-cherry-pick(1)โ Apply the changes introduced by some existing commits. (stealing a commit but make it legal ๐)git-citool(1)โ Graphical alternative togit-commit.git-clean(1)โ Remove untracked files from the working tree. (be careful, she's ruthless ๐)git-clone(1)โ Clone a repository into a new directory.git-commit(1)โ Record changes to the repository. The moment of truth โจgit-describe(1)โ Give an object a human readable name based on an available ref.git-diff(1)โ Show changes between commits, commit and working tree, etc.git-fetch(1)โ Download objects and refs from another repository.git-format-patch(1)โ Prepare patches for e-mail submission.git-gc(1)โ Cleanup unnecessary files and optimize the local repository.git-grep(1)โ Print lines matching a pattern.git-gui(1)โ A portable graphical interface to Git.git-history(1)โ EXPERIMENTAL: Rewrite history. (yes it's giving time traveller, mind the EXPERIMENTAL label bestie ๐)git-init(1)โ Create an empty Git repository or reinitialize an existing one.git-log(1)โ Show commit logs.git-maintenance(1)โ Run tasks to optimize Git repository data.git-merge(1)โ Join two or more development histories together.git-mv(1)โ Move or rename a file, a directory, or a symlink.git-notes(1)โ Add or inspect object notes.git-pull(1)โ Fetch from and integrate with another repository or a local branch.git-push(1)โ Update remote refs along with associated objects. The scary one, we respect her ๐ซถgit-range-diff(1)โ Compare two commit ranges (e.g. two versions of a branch).git-rebase(1)โ Reapply commits on top of another base tip.git-reset(1)โ SetHEADor the index to a known state.git-restore(1)โ Restore working tree files.git-revert(1)โ Revert some existing commits.git-rm(1)โ Remove files from the working tree and from the index.git-shortlog(1)โ Summarizegit logoutput.git-show(1)โ Show various types of objects.git-sparse-checkout(1)โ Reduce your working tree to a subset of tracked files.git-stash(1)โ Stash the changes in a dirty working directory away. (the "not right now, later" button ๐ )git-status(1)โ Show the working tree status.git-submodule(1)โ Initialize, update or inspect submodules.git-switch(1)โ Switch branches.git-tag(1)โ Create, list, delete or verify tags.git-worktree(1)โ Manage multiple working trees.gitk(1)โ The Git repository browser.scalar(1)โ A tool for managing large Git repositories.
๐ Ancillary Commands ๐
The supporting cast. Not the leads, but the plot does not work without them, periodt.
Manipulators:
These ones change stuff. Handle with care bestie, they can rearrange your whole life:
git-config(1)โ Get and set repository or global options.git-fast-export(1)โ Git data exporter.git-fast-import(1)โ Backend for fast Git data importers.git-filter-branch(1)โ Rewrite branches.git-mergetool(1)โ Run merge conflict resolution tools to resolve merge conflicts. (your emotional support tool during conflict season ๐ญ)git-pack-refs(1)โ Pack heads and tags for efficient repository access.git-prune(1)โ Prune all unreachable objects from the object database.git-reflog(1)โ Manage reflog information. (the "what did I even do last night" receipts ๐งพ)git-refs(1)โ Low-level access to refs.git-remote(1)โ Manage set of tracked repositories.git-repack(1)โ Pack unpacked objects in a repository.git-replace(1)โ Create, list, delete refs to replace objects.
Interrogators:
And these ones just ask questions. Nosy but harmless, we love an information-gathering queen ๐:
git-annotate(1)โ Annotate file lines with commit information.git-blame(1)โ Show what revision and author last modified each line of a file. (snitching on your teammates since forever ๐)git-bugreport(1)โ Collect information for user to file a bug report.git-count-objects(1)โ Count unpacked number of objects and their disk consumption.git-diagnose(1)โ Generate a zip archive of diagnostic information.git-difftool(1)โ Show changes using common diff tools.git-fsck(1)โ Verifies the connectivity and validity of the objects in the database.git-help(1)โ Display help information about Git.git-instaweb(1)โ Instantly browse your working repository ingitweb.git-merge-tree(1)โ Perform merge without touching index or working tree. (merge, but make it โจghostโจ)git-rerere(1)โ Reuse recorded resolution of conflicted merges.git-show-branch(1)โ Show branches and their commits.git-verify-commit(1)โ Check the GPG signature of commits.git-verify-tag(1)โ Check the GPG signature of tags.git-version(1)โ Display version information about Git.git-whatchanged(1)โ Show logs with differences each commit introduces.gitweb(1)โ Git web interface (web frontend to Git repositories).
๐ฆ Interacting with Others ๐ฆ
This little crew is all about talking to foreign SCMs and to other humans via patches over e-mail. Networking, but nerdy and honestly kind of iconic:
git-archimport(1)โ Import a GNU Arch repository into Git.git-cvsexportcommit(1)โ Export a single commit to a CVS checkout.git-cvsimport(1)โ Salvage your data out of another SCM people love to hate. (yes that's the actual description, no I did not write it, but I felt it ๐)git-cvsserver(1)โ A CVS server emulator for Git.git-imap-send(1)โ Send a collection of patches fromstdinto an IMAP folder.git-p4(1)โ Import from and submit to Perforce repositories.git-quiltimport(1)โ Applies a quilt patchset onto the current branch.git-request-pull(1)โ Generates a summary of pending changes.git-send-email(1)โ Send a collection of patches as emails.git-svn(1)โ Bidirectional operation between a Subversion repository and Git.
๐ Reset, restore and revert ๐
Okay this is the part where everybody gets confused, so listen up bestie, because there are three commands with lowkey similar names and they are not the same thing:
git-revert(1)is about making a new commit that reverts the changes made by other commits.git-restore(1)is about restoring files in the working tree from either the index or another commit. This command does not update your branch. The command can also be used to restore files in the index from another commit.git-reset(1)is about updating your branch, moving the tip in order to add or remove commits from the branch. This operation changes the commit history.
git resetcan also be used to restore the index, overlapping withgit restore. ๐
So like: revert = new commit that undoes, restore = files only, no branch drama, reset = moves your branch tip and rewrites history. Different girls, different jobs ๐ โจ
๐ง LOW-LEVEL COMMANDS (PLUMBING) ๐ง
okay so likeโฆ Git ships with its own porcelain layer, right? but the low-level commands are literally enough on their own to build whole alternative porcelains with bestie. if you're the kind of dev who wants to do that, start by reading git-update-index(1) and git-read-tree(1) โ that's the doorway ๐
and here's the tea: the interface to these low-level commands (input, output, set of options, the whole semantics situation) is meant to be way more stable than the Porcelain-level ones, because plumbing commands are primarily for scripted use. Porcelain interfaces? those are subject to change so the end-user experience can keep getting better. different vibes, different rules โจ
the low-level commands split into three little groups: ones that manipulate objects (in the repository, index, and working tree), ones that interrogate and compare objects, and ones that move objects and references between repositories. so organized, honestly ๐ซถ
๐ ๏ธ Manipulation commands
git-apply(1)โ apply a patch to files and/or to the index. ๐ฉนgit-checkout-index(1)โ copy files from the index to the working tree. ๐คgit-commit-graph(1)โ write and verify Git commit-graph files. ๐บ๏ธgit-commit-tree(1)โ create a new commit object. ๐ฑgit-hash-object(1)โ compute object ID and optionally create an object from a file. ๐ขgit-index-pack(1)โ build pack index file for an existing packed archive. ๐ฆgit-merge-file(1)โ run a three-way file merge. ๐git-merge-index(1)โ run a merge for files needing merging. ๐งฉgit-mktag(1)โ creates a tag object with extra validation. ๐ท๏ธgit-mktree(1)โ build a tree-object fromls-treeformatted text. ๐ณgit-multi-pack-index(1)โ write and verify multi-pack-indexes. ๐๏ธgit-pack-objects(1)โ create a packed archive of objects. ๐git-prune-packed(1)โ remove extra objects that are already in pack files. ๐งนgit-read-tree(1)โ reads tree information into the index. ๐git-replay(1)โ EXPERIMENTAL: replay commits on a new base, works with bare repos too. โ ๏ธgit-symbolic-ref(1)โ read, modify and delete symbolic refs. ๐git-unpack-objects(1)โ unpack objects from a packed archive. ๐คgit-update-index(1)โ register file contents in the working tree to the index. ๐git-update-ref(1)โ update the object name stored in a ref safely. ๐ก๏ธgit-write-tree(1)โ create a tree object from the current index. ๐ฒ
๐ Interrogation commands
git-cat-file(1)โ provide contents or details of repository objects. ๐ฑgit-cherry(1)โ find commits yet to be applied to upstream. ๐git-diff-files(1)โ compares files in the working tree and the index. ๐git-diff-index(1)โ compare a tree to the working tree or index. ๐ดgit-diff-pairs(1)โ compare the content and mode of provided blob pairs. ๐ฏgit-diff-tree(1)โ compares the content and mode of blobs found via two tree objects. ๐ณgit-for-each-ref(1)โ output information on each ref. ๐git-for-each-repo(1)โ run a Git command on a list of repositories. ๐git-format-rev(1)โ EXPERIMENTAL: pretty format revisions on demand. โจgit-get-tar-commit-id(1)โ extract commit ID from an archive created usinggit-archive. ๐๏ธgit-last-modified(1)โ EXPERIMENTAL: show when files were last modified. ๐ฐ๏ธgit-ls-files(1)โ show information about files in the index and the working tree. ๐git-ls-remote(1)โ list references in a remote repository. ๐git-ls-tree(1)โ list the contents of a tree object. ๐ณgit-merge-base(1)โ find as good common ancestors as possible for a merge. ๐ตgit-name-rev(1)โ find symbolic names for given revs. ๐ท๏ธgit-pack-redundant(1)โ find redundant pack files. ๐git-repo(1)โ retrieve information about the repository. ๐git-rev-list(1)โ lists commit objects in reverse chronological order. โณgit-rev-parse(1)โ pick out and massage parameters. ๐git-show-index(1)โ show packed archive index. ๐git-show-ref(1)โ list references in a local repository. ๐git-unpack-file(1)โ creates a temporary file with a blob's contents. ๐git-var(1)โ show a Git logical variable. ๐ฃgit-verify-pack(1)โ validate packed Git archive files. โ
big mood: in general, the interrogate commands do not touch the files in the working tree. they just look. no cap, they're literally just observing ๐โจ
๐ Syncing repositories
git-daemon(1)โ a really simple server for Git repositories. ๐ฅ๏ธgit-fetch-pack(1)โ receive missing objects from another repository. ๐ฅgit-http-backend(1)โ server side implementation of Git over HTTP. ๐git-send-pack(1)โ push objects over Git protocol to another repository. ๐คgit-update-server-info(1)โ update auxiliary info file to help dumb servers. ๐ง
the following are helper commands used by the ones above โ end users typically do not use them directly, so likeโฆ no pressure bestie ๐
git-http-fetch(1)โ download from a remote Git repository via HTTP. โฌ๏ธgit-http-push(1)โ push objects over HTTP/DAV to another repository. โฌ๏ธgit-receive-pack(1)โ receive what is pushed into the repository. ๐ฌgit-shell(1)โ restricted login shell for Git-only SSH access. ๐git-upload-archive(1)โ send archive back togit-archive. ๐๏ธgit-upload-pack(1)โ send objects packed back togit-fetch-pack. ๐ฆ
๐งฐ Internal helper commands
these are internal helper commands used by other commands; end users typically do not use them directly either, so consider this the backstage pass ๐๏ธ
git-check-attr(1)โ display gitattributes information. ๐ท๏ธgit-check-ignore(1)โ debuggitignore/ exclude files. ๐ซgit-check-mailmap(1)โ show canonical names and email addresses of contacts. ๐git-check-ref-format(1)โ ensures that a reference name is well formed. โ๏ธgit-column(1)โ display data in columns. ๐git-credential(1)โ retrieve and store user credentials. ๐git-credential-cache(1)โ helper to temporarily store passwords in memory. ๐งgit-credential-store(1)โ helper to store credentials on disk. ๐พgit-fmt-merge-msg(1)โ produce a merge commit message. ๐ฌgit-hook(1)โ run Git hooks. ๐ชgit-interpret-trailers(1)โ add or parse metadata in commit messages. ๐git-mailinfo(1)โ extracts patch and authorship from a single e-mail message. โ๏ธgit-mailsplit(1)โ simple UNIX mbox splitter program. ๐ฎgit-merge-one-file(1)โ the standard helper program to use withgit-merge-index. 1๏ธโฃgit-patch-id(1)โ compute unique IDs for patches. ๐git-sh-i18n(1)โ Git's i18n setup code for shell scripts. ๐git-sh-setup(1)โ common Git shell script setup code. ๐git-stripspace(1)โ remove unnecessary whitespace. ๐งฝgit-url-parse(1)โ parse and extract git URL components. ๐
๐ GUIDES ๐
these are the documentation pages that actually explain Git concepts, like the lore of it all ๐ง
gitcore-tutorial(7)โ a Git core tutorial for developers. ๐gitcredentials(7)โ providing usernames and passwords to Git. ๐gitcvs-migration(7)โ Git for CVS users. ๐ฐ๏ธgitdatamodel(7)โ Git's core data model. ๐๏ธgitdiffcore(7)โ tweaking diff output. ๐๏ธgiteveryday(7)โ a useful minimum set of commands for Everyday Git. โ๏ธgitfaq(7)โ frequently asked questions about using Git. โgitglossary(7)โ a Git Glossary. ๐gitnamespaces(7)โ Git namespaces. ๐๏ธgitremote-helpers(7)โ helper programs to interact with remote repositories. ๐คgitsubmodules(7)โ mounting one repository inside another. ๐ชgittutorial(7)โ a tutorial introduction to Git. ๐ฑgittutorial-2(7)โ a tutorial introduction to Git: part two. ๐ฟgitworkflows(7)โ an overview of recommended workflows with Git. ๐
๐๏ธ REPOSITORY, COMMAND AND FILE INTERFACES ๐๏ธ
this documentation discusses repository and command interfaces which users are expected to interact with directly. see --user-formats in git-help(1) for more details on the criteria, iykyk ๐
gitattributes(5)โ defining attributes per path. ๐ท๏ธgitcli(7)โ Git command-line interface and conventions. โจ๏ธgithooks(5)โ hooks used by Git. ๐ชgitignore(5)โ specifies intentionally untracked files to ignore. ๐gitmailmap(5)โ map author/committer names and/or E-Mail addresses. ๐งgitmodules(5)โ defining submodule properties. ๐งฉgitrepository-layout(5)โ Git Repository Layout. ๐๏ธgitrevisions(7)โ specifying revisions and ranges for Git. ๐ข
๐งฌ FILE FORMATS, PROTOCOLS AND OTHER DEVELOPER INTERFACES ๐งฌ
this documentation discusses file formats, over-the-wire protocols and other git developer interfaces. see --developer-interfaces in git-help(1) โ yes, that's where the criteria live ๐ซถ
gitformat-bundle(5)โ the bundle file format. ๐gitformat-chunk(5)โ chunk-based file formats. ๐งฑgitformat-commit-graph(5)โ Git commit-graph format. ๐บ๏ธgitformat-index(5)โ Git index format. ๐gitformat-pack(5)โ Git pack format. ๐ฆgitformat-signature(5)โ Git cryptographic signature formats. โ๏ธgitprotocol-capabilities(5)โ Protocol v0 and v1 capabilities. ๐งขgitprotocol-common(5)โ things common to various protocols. ๐คgitprotocol-http(5)โ Git HTTP-based protocols. ๐gitprotocol-pack(5)โ how packs are transferred over-the-wire. ๐gitprotocol-v2(5)โ Git Wire Protocol, Version 2. ๐ฐ๏ธ
โ๏ธ CONFIGURATION MECHANISM โ๏ธ
okay so Git uses a simple text format to store customizations that are per repository and per user. the config file can literally look like this:
#
# A '#' or ';' character indicates a comment.
#
; core variables
[core]
; Don't trust file modes
filemode = false
; user identity
[user]
name = "Junio C Hamano"
email = "gitster@pobox.com"
various commands read from the configuration file and adjust their operation accordingly. see git-config(1) for a list and more details about the configuration mechanism โ that's the whole master doc for config behavior, highly recommend ๐ซถโจ
๐ท๏ธ IDENTIFIER TERMINOLOGY
Okay so before anything else, let's get the vocab down, because Git docs throw these angle-bracket words around constantly and if you don't know them you're gonna be lost the whole time. ๐
<object>โ the object name for any type of object. The general-purpose one.<blob>โ a blob object name. Just the file-content bits, no name, no perms.<tree>โ a tree object name. Directory vibes.<commit>โ a commit object name. The whole snapshot moment, icon behavior.<tree-ish>โ a tree, commit, or tag object name. Lowkey the important bit: a command that takes a<tree-ish>argument ultimately wants to operate on a<tree>object, but it'll automatically dereference<commit>and<tag>objects that point at a<tree>. So it's flexible, it'll do the homework for you โจ<commit-ish>โ a commit or tag object name. Same deal: a command taking a<commit-ish>argument ultimately wants to operate on a<commit>object, but automatically dereferences<tag>objects that point at a<commit>.<type>โ means an object type is required. Currently one of:blob,tree,commit, ortag. Just those four, no cap.<file>โ a filename โ and this is the sneaky part โ almost always relative to the root of the tree structureGIT_INDEX_FILEdescribes. Not your cwd, bestie. The root of that tree. ๐ซถ
๐ฎ SYMBOLIC IDENTIFIERS
Any Git command that accepts any <object> can also use these symbolic shortcuts, and they're so convenient:
HEADโ indicates the head of the current branch. The main character, literally.<tag>โ a valid tag name (i.e. arefs/tags/<tag>reference).<head>โ a valid head name (i.e. arefs/heads/<head>reference).
For the full, complete, exhaustive list of ways you can spell object names, go read the "SPECIFYING REVISIONS" section in gitrevisions(7). There are so many ways. It's giving encyclopedia. ๐
๐๏ธ FILE/DIRECTORY STRUCTURE
Please see the gitrepository-layout(5) document for how the guts are laid out. ๐
Read githooks(5) for more details about each hook โ yes, each one has its own whole personality.
Higher level SCMs may provide and manage additional information in the $GIT_DIR. So if you're using something sitting on top of Git, it can stash its own stuff in there too.
๐ TERMINOLOGY
Please see gitglossary(7) โ that's the dictionary, go nuts.
And see gitdatamodel(7) for a discussion of the core data model, which includes important terminology used throughout the documentation. Genuinely worth the read if you want the whole thing to click. ๐ง โจ
๐ฑ ENVIRONMENT VARIABLES
Various Git commands pay attention to environment variables and change their behavior accordingly โ they're like little mood rings for your shell, but make it functional. ๐
Quick note on the ones marked "Boolean": they take their values the same way as Boolean valued configuration variables. So "true", "yes", "on" and positive numbers are all taken as "yes", while "false", "no", "off", and "0" are taken as "no". Easy.
Here are the variables, bestie:
๐ฅ๏ธ System
HOMEโ specifies the path to the user's home directory. On Windows, if it's unset, Git will set a process environment variable equal to:$HOMEDRIVE$HOMEPATHif both$HOMEDRIVEand$HOMEPATHexist; otherwise$USERPROFILEif$USERPROFILEexists. Windows really said "why have one variable when three will do" ๐ญPATHโ when a user runsgit <command>that is not part of the core Git programs (installed inGIT_EXEC_PATH),git-<command>that is runnable by the user in a directory on$PATHis invoked. Arguments passed after the command name are passed as-is to the program. And here's the ordering tea: to executegit <foo>, git finds command<foo>(either a core Git program found inGIT_EXEC_PATH, or a custom one in a directory onPATH), before tryingfooas an alias. So real programs win over aliases. Periodt. ๐
๐ฆ The Git Repository
These environment variables apply to all core Git commands. But โ important caveat โ it's worth noting that they may be used/overridden by SCMs sitting above Git, so take care if you're using a foreign front-end. ๐
GIT_INDEX_FILEโ specifies an alternate index file. If not specified, the default of$GIT_DIR/indexis used.GIT_INDEX_VERSIONโ specifies what index version is used when writing the index file out. It won't affect existing index files. By default index file version 2 or 3 is used. Seegit-update-index(1)for more information.GIT_OBJECT_DIRECTORYโ if the object storage directory is specified via this environment variable, then thesha1directories are created underneath it โ otherwise the default$GIT_DIR/objectsdirectory is used.GIT_ALTERNATE_OBJECT_DIRECTORIESโ okay so this is a good one. Because Git objects are immutable, old objects can be archived into shared, read-only directories. This variable specifies a":"separated (on Windows";"separated) list of Git object directories which can be used to search for Git objects. New objects will not be written to these directories. Read-only means read-only, bestie. ๐ โโ๏ธ
Entries that begin with " (double-quote) will be interpreted as C-style quoted paths, removing leading and trailing double-quotes and respecting backslash escapes. E.g., the value "path-with-\"-and-:-in-it":vanilla-path has two paths: path-with-"-and-:-in-it and vanilla-path. Cute little escape hatch for when your path is full of chaos. ๐
GIT_DIRโ if this is set, it specifies a path to use instead of the default.gitfor the base of the repository. The--git-dircommand-line option also sets this value.GIT_WORK_TREEโ set the path to the root of the working tree. This can also be controlled by the--work-treecommand-line option and thecore.worktreeconfiguration variable. Three ways to say the same thing, slay.GIT_NAMESPACEโ set the Git namespace; seegitnamespaces(7)for details. The--namespacecommand-line option also sets this value.GIT_CEILING_DIRECTORIESโ this should be a colon-separated list of absolute paths. If set, it's a list of directories that Git should not chdir up into while looking for a repository directory. Super useful for excluding slow-loading network directories. ๐
Important details: it will not exclude the current working directory, or a GIT_DIR set on the command line or in the environment. Normally, Git has to read the entries in this list and resolve any symlink that might be present in order to compare them with the current directory. But โ if even this access is slow, you can add an empty entry to the list to tell Git that the subsequent entries are not symlinks and needn't be resolved; e.g., GIT_CEILING_DIRECTORIES=/maybe/symlink::/very/slow/non/symlink. That double colon is doing so much work. ๐
GIT_DISCOVERY_ACROSS_FILESYSTEMโ when run in a directory that does not have a.gitrepository directory, Git tries to find such a directory in the parent directories to find the top of the working tree โ but by default it does not cross filesystem boundaries. This Boolean environment variable can be set to true to tell Git not to stop at filesystem boundaries. LikeGIT_CEILING_DIRECTORIES, this will not affect an explicit repository directory set viaGIT_DIRor on the command line.GIT_COMMON_DIRโ if this variable is set to a path, non-worktree files that are normally in$GIT_DIRwill be taken from this path instead. Worktree-specific files such asHEADorindexare taken from$GIT_DIR. Seegitrepository-layout(5)andgit-worktree(1)for details. Note: this variable has lower precedence than other path variables such asGIT_INDEX_FILE,GIT_OBJECT_DIRECTORYโฆ so it's not the boss of those, no matter how it acts. ๐GIT_DEFAULT_HASHโ if this variable is set, the default hash algorithm for new repositories will be set to this value. This value is ignored when cloning โ the setting of the remote repository is always used instead. The default is"sha1". See--object-formatingit-init(1).GIT_DEFAULT_REF_FORMATโ if this variable is set, the default reference backend format for new repositories will be set to this value. The default is"files". See--ref-formatingit-init(1).GIT_REFERENCE_BACKENDโ specify which reference backend to be used along with its URI. See theextensions.refStorageoption ingit-config(1)for more details. Overrides the config variable when used. Yeah, it wins. ๐ช
โ๏ธ Git Commits
GIT_AUTHOR_NAMEโ the human-readable name used in the author identity when creating commit or tag objects, or when writing reflogs. Overrides theuser.nameandauthor.nameconfiguration settings.GIT_AUTHOR_EMAILโ the email address used in the author identity when creating commit or tag objects, or when writing reflogs. Overrides theuser.emailandauthor.emailconfiguration settings.GIT_AUTHOR_DATEโ the date used for the author identity when creating commit or tag objects, or when writing reflogs. Seegit-commit(1)for valid formats. There are lots of valid formats. Go wild, respectfully. ๐GIT_COMMITTER_NAMEโ the human-readable name used in the committer identity when creating commit or tag objects, or when writing reflogs. Overrides theuser.nameandcommitter.nameconfiguration settings.GIT_COMMITTER_EMAILโ the email address used in the author identity when creating commit or tag objects, or when writing reflogs. Overrides theuser.emailandcommitter.emailconfiguration settings.GIT_COMMITTER_DATEโ the date used for the committer identity when creating commit or tag objects, or when writing reflogs. Seegit-commit(1)for valid formats.EMAILโ the email address used in the author and committer identities if no other relevant environment variable or configuration setting has been set. The final fallback bestie, the last one standing. ๐ซถ
๐ Git Diffs
GIT_DIFF_OPTSโ the only valid setting is"--unified=??"or"-u??"to set the number of context lines shown when a unified diff is created. This takes precedence over any"-U"or"--unified"option value passed on the Git diff command line. So it overrules your flags, lowkey rude but iconic.GIT_EXTERNAL_DIFFโ when this environment variable is set, the program named by it is called to generate diffs, and Git does not use its builtin diff machinery. Plug in your own diff engine, main character energy. ๐ฅ
For a path that is added, removed, or modified, GIT_EXTERNAL_DIFF is called with 7 parameters:
path old-file old-hex old-mode new-file new-hex new-mode
where:
<old|new>-fileโ are filesGIT_EXTERNAL_DIFFcan use to read the contents of<old|new>,<old|new>-hexโ are the 40-hexdigit SHA-1 hashes,<old|new>-modeโ are the octal representation of the file modes.
The file parameters can point at the user's working file (e.g. new-file in git-diff-files), /dev/null (e.g. old-file when a new file is added), or a temporary file (e.g. old-file in the index). And heads up: GIT_EXTERNAL_DIFF should not worry about unlinking the temporary file โ it is removed when GIT_EXTERNAL_DIFF exits. Git handles the cleanup, you just vibe. โจ
For a path that is unmerged, GIT_EXTERNAL_DIFF is called with 1 parameter, <path>.
For each path GIT_EXTERNAL_DIFF is called on, two environment variables โ GIT_DIFF_PATH_COUNTER and GIT_DIFF_PATH_TOTAL โ are set.
GIT_EXTERNAL_DIFF_TRUST_EXIT_CODEโ if this Boolean environment variable is set to true, then theGIT_EXTERNAL_DIFFcommand is expected to return exit code0if it considers the input files to be equal, or1if it considers them to be different, likediff(1). If it is set to false โ which is the default โ then the command is expected to return exit code0regardless of equality. Any other exit code causes Git to report a fatal error ๐. So yeah, know which mode you're in before you ship that diff driver.GIT_DIFF_PATH_COUNTERโ a 1-based counter incremented by one for every path.
โฆand the env var section is still going, stay with me bestie ๐ซถ
GIT_DIFF_PATH_TOTALโ the total number of paths. that's it, that's the whole vibe ๐
๐ธ other ๐ธ
GIT_MERGE_VERBOSITYโ a number controlling how much output the recursive merge strategy shows. it overridesmerge.verbosity. seegit-merge(1)for the lore โจGIT_PAGERโ overrides$PAGER. and bestie, listen: if you set it to an empty string or to the value"cat", Git will not launch a pager at all ๐ซ๐. see also thecore.pageroption ingit-config(1).GIT_PROGRESS_DELAYโ a number controlling how many seconds to delay before showing optional progress indicators. defaults to1โณ.GIT_EDITORโ overrides$EDITORand$VISUAL. several Git commands use it when they need to launch an editor in interactive mode. see alsogit-var(1)and thecore.editoroption ingit-config(1)๐๏ธ.GIT_SEQUENCE_EDITORโ overrides the configured Git editor specifically when you're editing the todo list of an interactive rebase. see alsogit-rebase(1)and thesequence.editoroption ingit-config(1)๐.GIT_SSH,GIT_SSH_COMMANDโ if either one is set, thengit fetchandgit pushwill use the specified command instead ofsshwhen they need to connect to a remote system. the command-line parameters passed to the configured command are determined by the ssh variant โ see thessh.variantoption ingit-config(1)for the deets.$GIT_SSH_COMMANDtakes precedence over$GIT_SSH, and it's interpreted by the shell, which means you can sneak extra arguments in there ๐.$GIT_SSHon the other hand must be just the path to a program (which can totally be a wrapper shell script if you need extra arguments โ loophole unlocked).- usually it's easier to configure whatever options you want through your personal
.ssh/configfile. please consult your ssh documentation for further details ๐ซถ.
GIT_SSH_VARIANTโ if this is set, it overrides Git's autodetection of whetherGIT_SSH/GIT_SSH_COMMAND/core.sshCommandrefer to OpenSSH, plink or tortoiseplink. this variable overrides the config settingssh.variant, which does the same job ๐.GIT_SSL_NO_VERIFYโ setting and exporting this to any value tells Git not to verify the SSL certificate when fetching or pushing over HTTPS.
โ ๏ธ bestie this is the "skip the vibe check" button for certificates. any value. even 0. be so serious about when you use it.
GIT_ATTR_SOURCEโ sets the treeish that gitattributes will be read from ๐ณ.GIT_ASKPASSโ if this is set, then Git commands that need to acquire passwords or passphrases (e.g. for HTTP or IMAP authentication) will call this program with a suitable prompt as a command-line argument and read the password from its STDOUT. see also thecore.askPassoption ingit-config(1)๐.GIT_TERMINAL_PROMPTโ if this Boolean environment variable is set to false, git will not prompt on the terminal (e.g., when asking for HTTP authentication) ๐ค.GIT_CONFIG_GLOBAL,GIT_CONFIG_SYSTEMโ take the configuration from the given files instead of from global or system-level configuration files. ifGIT_CONFIG_SYSTEMis set, the system config file defined at build time (usually/etc/gitconfig) will not be read. likewise, ifGIT_CONFIG_GLOBALis set, neither$HOME/.gitconfignor$XDG_CONFIG_HOME/git/configwill be read. can be set to/dev/nullto skip reading configuration files of the respective level ๐ณ๏ธ.GIT_CONFIG_NOSYSTEMโ whether to skip reading settings from the system-wide$(prefix)/etc/gitconfigfile. this Boolean environment variable can be used along with$HOMEand$XDG_CONFIG_HOMEto create a predictable environment for a picky script, or you can set it to true to temporarily dodge a buggy/etc/gitconfigfile while you wait for someone with sufficient permissions to fix it ๐ ๏ธ.GIT_FLUSHโ if this Boolean environment variable is set to true, then commands such asgit blame(in incremental mode),git rev-list,git log,git check-attrandgit check-ignorewill force a flush of the output stream after each record has been flushed. if it's set to false, the output of these commands will be done using completely buffered I/O. if this environment variable is not set, Git will choose buffered or record-oriented flushing based on whether stdout appears to be redirected to a file or not ๐ฟ.GIT_TRACEโ enables general trace messages, e.g. alias expansion, built-in command execution and external command execution ๐.- if set to
"1","2"or"true"(comparison is case insensitive), trace messages will be printed to stderr. - if it's set to an integer value greater than
2and lower than10(strictly), then Git will interpret this value as an open file descriptor and will try to write the trace messages into that file descriptor. - alternatively, if it's set to an absolute path (starting with a
/character), Git will interpret this as a file path and will try to append the trace messages to it. - unsetting the variable, or setting it to empty,
"0"or"false"(case insensitive) disables trace messages ๐.
- if set to
GIT_TRACE_FSMONITORโ enables trace messages for the filesystem monitor extension. seeGIT_TRACEfor available trace output options ๐๏ธ.GIT_TRACE_PACK_ACCESSโ enables trace messages for all accesses to any packs. for each access, the pack file name and an offset in the pack is recorded. this may be helpful for troubleshooting some pack-related performance problems. seeGIT_TRACEfor available trace output options ๐ฆ.GIT_TRACE_PACKETโ enables trace messages for all packets coming in or out of a given program. this can help with debugging object negotiation or other protocol issues. tracing is turned off at a packet starting with"PACK"(but seeGIT_TRACE_PACKFILEbelow). seeGIT_TRACEfor available trace output options ๐จ.GIT_TRACE_PACKFILEโ enables tracing of packfiles sent or received by a given program. unlike other trace output, this trace is verbatim: no headers, and no quoting of binary data. you almost certainly want to direct it into a file (e.g.,GIT_TRACE_PACKFILE=/tmp/my.pack) rather than displaying it on the terminal or mixing it with other trace output ๐๏ธ.- note that this is currently only implemented for the client side of clones and fetches.
GIT_TRACE_PERFORMANCEโ enables performance related trace messages, e.g. total execution time of each Git command. seeGIT_TRACEfor available trace output options โฑ๏ธ.GIT_TRACE_REFSโ enables trace messages for operations on the ref database. seeGIT_TRACEfor available trace output options ๐.GIT_TRACE_SETUPโ enables trace messages printing the.git, working tree and current working directory after Git has completed its setup phase. seeGIT_TRACEfor available trace output options ๐งญ.GIT_TRACE_SHALLOWโ enables trace messages that can help debugging fetching / cloning of shallow repositories. seeGIT_TRACEfor available trace output options ๐.GIT_TRACE_CURLโ enables a curl full trace dump of all incoming and outgoing data, including descriptive information, of the git transport protocol. this is similar to doingcurl --trace-asciion the command line. seeGIT_TRACEfor available trace output options ๐.GIT_TRACE_CURL_NO_DATAโ when a curl trace is enabled (seeGIT_TRACE_CURLabove), do not dump data (that is, only dump info lines and headers) ๐.GIT_TRACE2โ enables more detailed trace messages from the"trace2"library. output fromGIT_TRACE2is a simple text-based format for human readability ๐.- if set to
"1","2"or"true"(comparison is case insensitive), trace messages will be printed to stderr. - if it's set to an integer value greater than
2and lower than10(strictly), then Git will interpret this value as an open file descriptor and will try to write the trace messages into that file descriptor. - alternatively, if it's set to an absolute path (starting with a
/character), Git will interpret this as a file path and will try to append the trace messages to it. if the path already exists and is a directory, the trace messages will be written to files (one per process) in that directory, named according to the last component of the SID and an optional counter (to avoid filename collisions) ๐. - in addition, if the variable is set to
af_unix:[<socket-type>:]<absolute-pathname>, Git will try to open the path as a Unix Domain Socket. the socket type can be eitherstreamordgram๐. - unsetting the variable, or setting it to empty,
"0"or"false"(case insensitive) disables trace messages. - see Trace2 documentation[2] for full details.
- if set to
GIT_TRACE2_EVENTโ this setting writes a JSON-based format that is suited for machine interpretation. seeGIT_TRACE2for available trace output options and Trace2 documentation[2] for full details ๐ค.GIT_TRACE2_PERFโ in addition to the text-based messages available inGIT_TRACE2, this setting writes a column-based format for understanding nesting regions. seeGIT_TRACE2for available trace output options and Trace2 documentation[2] for full details ๐.GIT_TRACE_REDACTโ by default, when tracing is activated, Git redacts the values of cookies, the"Authorization:"header, the"Proxy-Authorization:"header and packfile URIs. set this Boolean environment variable to false to prevent this redaction ๐ต๏ธ.GIT_NO_REPLACE_OBJECTSโ setting and exporting this environment variable tells Git to ignore replacement refs and not replace Git objects ๐ซ๐.GIT_LITERAL_PATHSPECSโ setting this Boolean environment variable to true will cause Git to treat all pathspecs literally, rather than as glob patterns. for example, runningGIT_LITERAL_PATHSPECS=1 git log -- '*.c'will search for commits that touch the path*.c, not any paths that the glob*.cmatches. you might want this if you're feeding literal paths to Git (e.g., paths previously given to you bygit ls-tree,--rawdiff output, etc) ๐ฏ.GIT_GLOB_PATHSPECSโ setting this Boolean environment variable to true will cause Git to treat all pathspecs as glob patterns (aka"glob"magic) ๐.GIT_NOGLOB_PATHSPECSโ setting this Boolean environment variable to true will cause Git to treat all pathspecs as literal (aka"literal"magic) ๐.GIT_ICASE_PATHSPECSโ setting this Boolean environment variable to true will cause Git to treat all pathspecs as case-insensitive ๐ .GIT_NO_LAZY_FETCHโ set this Boolean envvar to true and Git will not lazily fetch missing objects from the promisor remote on demand. like, it just won't go get them ๐GIT_REFLOG_ACTIONโ whenever a ref gets updated, reflog entries are created to keep track of why the ref was updated (which is usually the name of the high-level command that did the updating), plus the old and new values of the ref. A scripted Porcelain command can use theset_reflog_actionhelper function ingit-sh-setupto set its own name into this variable when the end user invokes it as the top level command, so it gets recorded in the body of the reflog. iykyk ๐GIT_REF_PARANOIAโ if this Boolean envvar is set to false, Git ignores broken or badly named refs when iterating over lists of refs. Normally Git tries to include any such refs, which may cause some operations to fail. And honestly? that's usually preferable, because potentially destructive operations (e.g.,git-prune(1)) are way better off aborting than ignoring broken refs (and thus considering the history they point to as not worth saving ๐ญ). The default value is1(i.e., be paranoid about detecting and aborting all operations). You should not normally need to set this to0, but it may be useful when you're trying to salvage data from a corrupted repository. salvage mission vibes ๐งGIT_COMMIT_GRAPH_PARANOIAโ when loading a commit object from the commit-graph, Git performs an existence check on the object in the object database. This is done to avoid issues with stale commit-graphs that contain references to already-deleted commits, but it comes with a performance penalty.
The default is "false", which disables the aforementioned behavior. Setting this to "true" enables the existence check so that stale commits will never be returned from the commit-graph โ at the cost of performance. pick your battles bestie โ๏ธ
GIT_ALLOW_PROTOCOLโ if set to a colon-separated list of protocols, behave as ifprotocol.allowis set tonever, and each of the listed protocols hasprotocol.<name>.allowset toalways(overriding any existing configuration). See the description ofprotocol.allowingit-config(1)for more details. it's giving allowlist energy ๐ฅGIT_PROTOCOL_FROM_USERโ set this Boolean envvar to false to prevent protocols used by fetch/push/clone which are configured to the user state. This is useful to restrict recursive submodule initialization from an untrusted repository, or for programs which feed potentially-untrusted URLs to git commands. Seegit-config(1)for more details. protecting the group chat from weird links, we love to see it ๐ซถGIT_PROTOCOLโ for internal use only. Used in handshaking the wire protocol. Contains a colon:separated list of keys with optional values<key>[=<value>]. Presence of unknown keys and values must be ignored.
Note that servers may need to be configured to allow this variable to pass over some transports. It will be propagated automatically when accessing local repositories (i.e., file:// or a filesystem path), as well as over the git:// protocol. For git-over-http, it should work automatically in most configurations, but see the discussion in git-http-backend(1). For git-over-ssh, the ssh server may need to be configured to allow clients to pass this variable (e.g., by using AcceptEnv GIT_PROTOCOL with OpenSSH).
This configuration is optional. If the variable is not propagated, then clients will fall back to the original "v0" protocol (but may miss out on some performance improvements or features). This variable currently only affects clones and fetches; it is not yet used for pushes (but may be in the future). โจ
GIT_OPTIONAL_LOCKSโ if this Boolean envvar is set to false, Git will complete any requested operation without performing any optional sub-operations that require taking a lock. For example, this will preventgit statusfrom refreshing the index as a side effect. This is useful for processes running in the background which do not want to cause lock contention with other operations on the repository. Defaults to1. no drama, no locks ๐GIT_REDIRECT_STDIN,GIT_REDIRECT_STDOUT,GIT_REDIRECT_STDERRโ Windows-only: allow redirecting the standard input/output/error handles to paths specified by the environment variables. This is particularly useful in multi-threaded applications where the canonical way to pass standard handles viaCreateProcess()is not an option because it would require the handles to be marked inheritable (and consequently every spawned process would inherit them, possibly blocking regular Git operations). The primary intended use case is to use named pipes for communication (e.g.\\.\pipe\my-git-stdin-123).
Two special values are supported: off will simply close the corresponding standard handle, and if GIT_REDIRECT_STDERR is 2>&1, standard error will be redirected to the same handle as standard output. windows being windows, but make it iconic ๐ช
GIT_PRINT_SHA1_ELLIPSIS(deprecated) โ if set toyes, print an ellipsis following an (abbreviated) SHA-1 value. This affects indications of detached HEADs (git-checkout(1)) and the raw diff output (git-diff(1)). Printing an ellipsis in the cases mentioned is no longer considered adequate and support for it is likely to be removed in the foreseeable future (along with the variable). bestie it's deprecated, don't get attached ๐GIT_ADVICEโ if set to0, then disable all advice messages. These messages are intended to provide hints to human users that may help them get out of problematic situations or take advantage of new features. Users can disable individual messages using theadvice.*config keys. These messages may be disruptive to tools that execute Git processes, so this variable is available to disable the messages. (The--no-adviceglobal option is also available, but old Git versions may fail when this option is not understood. The environment variable will be ignored by Git versions that do not understand it.) sometimes you just don't want the unsolicited advice, valid ๐
๐ฌ DISCUSSION ๐ฌ
More detail on the following is available from the Git concepts chapter of the user-manual[3] and gitcore-tutorial(7).
A Git project normally consists of a working directory with a ".git" subdirectory at the top level. The .git directory contains, among other things, a compressed object database representing the complete history of the project, an "index" file which links that history to the current contents of the working tree, and named pointers into that history such as tags and branch heads. it's giving whole personality in one folder ๐
The object database contains objects of three main types: blobs, which hold file data; trees, which point to blobs and other trees to build up directory hierarchies; and commits, which each reference a single tree and some number of parent commits. the holy trinity honestly ๐
The commit โ equivalent to what other systems call a "changeset" or "version" โ represents a step in the project's history, and each parent represents an immediately preceding step. Commits with more than one parent represent merges of independent lines of development. family tree but make it version control ๐ณ
All objects are named by the SHA-1 hash of their contents, normally written as a string of 40 hex digits. Such names are globally unique. The entire history leading up to a commit can be vouched for by signing just that commit. A fourth object type, the tag, is provided for this purpose. sign one thing, cover the whole timeline, main character energy fr fr โจ
When first created, objects are stored in individual files, but for efficiency may later be compressed together into "pack files". glow-up arc ๐ฆ
Named pointers called refs mark interesting points in history. A ref may contain the SHA-1 name of an object or the name of another ref (the latter is called a "symbolic ref"). Refs with names beginning refs/head/ contain the SHA-1 name of the most recent commit (or "head") of a branch under development. SHA-1 names of tags of interest are stored under refs/tags/. A symbolic ref named HEAD contains the name of the currently checked-out branch. bookmarking your fave moments ๐
The index file is initialized with a list of all paths and, for each path, a blob object and a set of attributes. The blob object represents the contents of the file as of the head of the current branch. The attributes (last modified time, size, etc.) are taken from the corresponding file in the working tree. Subsequent changes to the working tree can be found by comparing these attributes. The index may be updated with new content, and new commits may be created from the content stored in the index. the index is literally the group chat between your files and your history ๐ฆ
The index is also capable of storing multiple entries (called "stages") for a given pathname. These stages are used to hold the various unmerged version of a file when a merge is in progress. conflict era, we've all been there ๐ญ
๐ SECURITY ๐
Some configuration options and hook files may cause Git to run arbitrary shell commands. Because configuration and hooks are not copied using git clone, it is generally safe to clone remote repositories with untrusted content, inspect them with git log, and so on. ngl that's the reassuring part ๐ซถ
However, it is not safe to run Git commands in a .git directory (or the working tree that surrounds it) when that .git directory itself comes from an untrusted source. The commands in its config and hooks are executed in the usual way. like, it WILL run them. no cap. ๐จ
By default, Git will refuse to run when the repository is owned by someone other than the user running the command. See the entry for safe.directory in git-config(1). While this can help protect you in a multi-user environment, note that you can also acquire untrusted repositories that are owned by you (for example, if you extract a zip file or tarball from an untrusted source). In such cases, you'd need to "sanitize" the untrusted repository first. ownership is not a vibe check, bestie ๐
If you have an untrusted .git directory, you should first clone it with git clone --no-local to obtain a clean copy. Git does restrict the set of options and hooks that will be run by upload-pack, which handles the server side of a clone or fetch, but beware that the surface area for attack against upload-pack is large, so this does carry some risk. The safest thing is to serve the repository as an unprivileged user (either via git-daemon(1), ssh, or using other tools to change user ids). See the discussion in the SECURITY section of git-upload-pack(1). stay safe out there ๐ฅ
๐ FURTHER DOCUMENTATION ๐
See the references in the "description" section to get started using Git. The following is probably more detail than necessary for a first-time user. (lowkey true but we're here anyway ๐
)
The Git concepts chapter of the user-manual[3] and gitcore-tutorial(7) both provide introductions to the underlying Git architecture. start here if you wanna actually get it ๐ง โจ
See gitworkflows(7) for an overview of recommended workflows. the "how do teams actually do this" doc ๐
See also the howto[4] documents for some useful examples. examples ate, no notes ๐
The internals are documented in the Git API documentation[5]. for the brave ones ๐ฆ
Users migrating from CVS may also want to read gitcvs-migration(7). welcome to the future, we're happy you're here ๐
๐ AUTHORS ๐
okay so Gitโs origin story is iconic: it was started by Linus Torvalds, and itโs currently maintained by Junio C Hamano. periodt. โจ
A whole ton of contributions have come from the Git mailing list <git@vger.kernel.org[6]> ๐ซถ โ and if you want the fuller contributor roll call, https://openhub.net/p/git/contributors/summary has you covered.
If youโve got a clone of git.git itself, the output of git-shortlog(1) and git-blame(1) can show you the authors for specific parts of the project. iykyk ๐
๐ REPORTING BUGS ๐
Bug reports go to the Git mailing list <git@vger.kernel.org[6]>, which is where development and maintenance is primarily done. You do not have to be subscribed to the list to send a message there, bestie โ just send it ๐
Want to peep previous bug reports and other discussions? The list archive is at https://lore.kernel.org/git.
๐จ If an issue is security relevant, disclose it privately to the Git Security mailing list <git-security@googlegroups.com[7]>. Do not do the whole public group-chat thing with security stuff, okay? ๐
๐ SEE ALSO ๐
gittutorial(7)gittutorial-2(7)giteveryday(7)gitcvs-migration(7)gitglossary(7)gitdatamodel(7)gitcore-tutorial(7)gitcli(7)- The Git Userโs Manual[1]
gitworkflows(7)
๐ GIT ๐
Part of the git(1) suite. slay. ๐
๐ NOTES ๐
- Git Userโs Manual โ
file:///usr/share/doc/git-doc/user-manual.html - Trace2 documentation โ
file:///usr/share/doc/git-doc/technical/api-trace2.html - Git concepts chapter of the user-manual โ
file:///usr/share/doc/git-doc/user-manual.html#git-concepts - howto โ
file:///usr/share/doc/git-doc/howto-index.html - Git API documentation โ
file:///usr/share/doc/git-doc/technical/api-index.html - git@vger.kernel.org โ
mailto:git@vger.kernel.org - git-security@googlegroups.com โ
mailto:git-security@googlegroups.com
Signed, sealed, delivered: Git 2.56.0, dated 2026-09-27, page GIT(1) ๐ซถ๐
๐ฆ where this page comes from
- arch rolling: git 2.56.0-1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms