Create a new repository in any existing directory
git init ~/myrepo
cd ~/myrepo
git-init - Create an empty Git repository or reinitialize an existing one
Initialized empty Git repository in /home/dylan/myrepo/.git/
ls .git
HEAD config description hooks info objects refs
cat .git/config
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true
git config --local -l
git-config - Get and set repository or global options
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
git config -h
git help config
git help
usage: git config [<options>]
Config file location
--global use global config file
--system use system config file
--local use repository config file
-f, --file <file> use given config file
--blob <blob-id> read config from given blob object
Action
--get get value: name [value-regex]
--get-all get all values: key [value-regex]
--get-regexp get values for regexp: name-regex [value-regex]
--get-urlmatch get value specific for the URL: section[.var] URL
--replace-all replace all matching variables: name value [value_regex]
--add add a new variable: name value
--unset remove a variable: name [value-regex]
--unset-all remove all matches: name [value-regex]
--rename-section rename section: old-name new-name
--remove-section remove a section: name
-l, --list list all
-e, --edit open an editor
--get-color find the color configured: slot [default]
--get-colorbool find the color setting: slot [stdout-is-tty]
Type
--bool value is "true" or "false"
--int value is decimal number
--bool-or-int value is --bool or --int
--path value is a path (file or directory name)
Other
-z, --null terminate values with NUL byte
--name-only show variable names only
--includes respect include directives on lookup
--show-origin show origin of config (file, standard input, blob, command line)
git-help - Display help information about Git
GIT-CONFIG(1) Git Manual GIT-CONFIG(1)
NNAAMMEE
git-config - Get and set repository or global options
SSYYNNOOPPSSIISS
_g_i_t _c_o_n_f_i_g [<file-option>] [type] [--show-origin] [-z|--null] name [value [value_regex]]
_g_i_t _c_o_n_f_i_g [<file-option>] [type] --add name value
_g_i_t _c_o_n_f_i_g [<file-option>] [type] --replace-all name value [value_regex]
_g_i_t _c_o_n_f_i_g [<file-option>] [type] [--show-origin] [-z|--null] --get name [value_regex]
_g_i_t _c_o_n_f_i_g [<file-option>] [type] [--show-origin] [-z|--null] --get-all name [value_regex]
_g_i_t _c_o_n_f_i_g [<file-option>] [type] [--show-origin] [-z|--null] [--name-only] --get-regexp name_regex [value_regex]
_g_i_t _c_o_n_f_i_g [<file-option>] [type] [-z|--null] --get-urlmatch name URL
_g_i_t _c_o_n_f_i_g [<file-option>] --unset name [value_regex]
_g_i_t _c_o_n_f_i_g [<file-option>] --unset-all name [value_regex]
_g_i_t _c_o_n_f_i_g [<file-option>] --rename-section old_name new_name
_g_i_t _c_o_n_f_i_g [<file-option>] --remove-section name
_g_i_t _c_o_n_f_i_g [<file-option>] [--show-origin] [-z|--null] [--name-only] -l | --list
_g_i_t _c_o_n_f_i_g [<file-option>] --get-color name [default]
_g_i_t _c_o_n_f_i_g [<file-option>] --get-colorbool name [stdout-is-tty]
_g_i_t _c_o_n_f_i_g [<file-option>] -e | --edit
DDEESSCCRRIIPPTTIIOONN
You can query/set/replace/unset options with this command. The name is
actually the section and the key separated by a dot, and the value will
be escaped.
Multiple lines can be added to an option by using the ----aadddd option. If
you want to update or unset an option which can occur on multiple
lines, a POSIX regexp vvaalluuee__rreeggeexx needs to be given. Only the existing
values that match the regexp are updated or unset. If you want to
handle the lines that do nnoott match the regex, just prepend a single
exclamation mark in front (see also the section called “EXAMPLES”).
The type specifier can be either ----iinntt or ----bbooooll, to make _g_i_t _c_o_n_f_i_g
ensure that the variable(s) are of the given type and convert the value
to the canonical form (simple decimal number for int, a "true" or
"false" string for bool), or ----ppaatthh, which does some path expansion
(see ----ppaatthh below). If no type specifier is passed, no checks or
transformations are performed on the value.
When reading, the values are read from the system, global and
repository local configuration files by default, and options ----ssyysstteemm,
----gglloobbaall, ----llooccaall and ----ffiillee <<ffiilleennaammee>> can be used to tell the command
to read from only that location (see the section called “FILES”).
When writing, the new value is written to the repository local
configuration file by default, and options ----ssyysstteemm, ----gglloobbaall, ----ffiillee
<<ffiilleennaammee>> can be used to tell the command to write to that location
(you can say ----llooccaall but that is the default).
This command will fail with non-zero status upon error. Some exit codes
are:
· The section or key is invalid (ret=1),
· no section or name was provided (ret=2),
· the config file is invalid (ret=3),
· the config file cannot be written (ret=4),
· you try to unset an option which does not exist (ret=5),
· you try to unset/set an option for which multiple lines match
(ret=5), or
· you try to use an invalid regexp (ret=6).
On success, the command returns the exit code 0.
OOPPTTIIOONNSS
--replace-all
Default behavior is to replace at most one line. This replaces all
lines matching the key (and optionally the value_regex).
--add
Adds a new line to the option without altering any existing values.
This is the same as providing _^_$ as the value_regex in
----rreeppllaaccee--aallll.
--get
Get the value for a given key (optionally filtered by a regex
matching the value). Returns error code 1 if the key was not found
and the last value if multiple key values were found.
--get-all
Like get, but returns all values for a multi-valued key.
--get-regexp
Like --get-all, but interprets the name as a regular expression and
writes out the key names. Regular expression matching is currently
case-sensitive and done against a canonicalized version of the key
in which section and variable names are lowercased, but subsection
names are not.
--get-urlmatch name URL
When given a two-part name section.key, the value for
section.<url>.key whose <url> part matches the best to the given
URL is returned (if no such key exists, the value for section.key
is used as a fallback). When given just the section as name, do so
for all the keys in the section and list them. Returns error code 1
if no value is found.
--global
For writing options: write to global ~~//..ggiittccoonnffiigg file rather than
the repository ..ggiitt//ccoonnffiigg, write to $$XXDDGG__CCOONNFFIIGG__HHOOMMEE//ggiitt//ccoonnffiigg
file if this file exists and the ~~//..ggiittccoonnffiigg file doesn’t.
For reading options: read only from global ~~//..ggiittccoonnffiigg and from
$$XXDDGG__CCOONNFFIIGG__HHOOMMEE//ggiitt//ccoonnffiigg rather than from all available files.
See also the section called “FILES”.
--system
For writing options: write to system-wide $$((pprreeffiixx))//eettcc//ggiittccoonnffiigg
rather than the repository ..ggiitt//ccoonnffiigg.
For reading options: read only from system-wide
$$((pprreeffiixx))//eettcc//ggiittccoonnffiigg rather than from all available files.
See also the section called “FILES”.
--local
For writing options: write to the repository ..ggiitt//ccoonnffiigg file. This
is the default behavior.
For reading options: read only from the repository ..ggiitt//ccoonnffiigg
rather than from all available files.
See also the section called “FILES”.
-f config-file, --file config-file
Use the given config file instead of the one specified by
GIT_CONFIG.
--blob blob
Similar to ----ffiillee but use the given blob instead of a file. E.g.
you can use _m_a_s_t_e_r_:_._g_i_t_m_o_d_u_l_e_s to read values from the file
_._g_i_t_m_o_d_u_l_e_s in the master branch. See "SPECIFYING REVISIONS"
section in ggiittrreevviissiioonnss(7) for a more complete list of ways to
spell blob names.
--remove-section
Remove the given section from the configuration file.
--rename-section
Rename the given section to a new name.
--unset
Remove the line matching the key from config file.
--unset-all
Remove all lines matching the key from config file.
-l, --list
List all variables set in config file, along with their values.
--bool
_g_i_t _c_o_n_f_i_g will ensure that the output is "true" or "false"
--int
_g_i_t _c_o_n_f_i_g will ensure that the output is a simple decimal number.
An optional value suffix of _k, _m, or _g in the config file will
cause the value to be multiplied by 1024, 1048576, or 1073741824
prior to output.
--bool-or-int
_g_i_t _c_o_n_f_i_g will ensure that the output matches the format of either
--bool or --int, as described above.
--path
_g_i_t_-_c_o_n_f_i_g will expand leading _~ to the value of _$_H_O_M_E, and _~_u_s_e_r
to the home directory for the specified user. This option has no
effect when setting the value (but you can use _g_i_t _c_o_n_f_i_g _b_l_a _~_/
from the command line to let your shell do the expansion).
-z, --null
For all options that output values and/or keys, always end values
with the null character (instead of a newline). Use newline instead
as a delimiter between key and value. This allows for secure
parsing of the output without getting confused e.g. by values that
contain line breaks.
--name-only
Output only the names of config variables for ----lliisstt or
----ggeett--rreeggeexxpp.
--show-origin
Augment the output of all queried config options with the origin
type (file, standard input, blob, command line) and the actual
origin (config file path, ref, or blob id if applicable).
--get-colorbool name [stdout-is-tty]
Find the color setting for nnaammee (e.g. ccoolloorr..ddiiffff) and output
"true" or "false". ssttddoouutt--iiss--ttttyy should be either "true" or
"false", and is taken into account when configuration says "auto".
If ssttddoouutt--iiss--ttttyy is missing, then checks the standard output of the
command itself, and exits with status 0 if color is to be used, or
exits with status 1 otherwise. When the color setting for nnaammee is
undefined, the command uses ccoolloorr..uuii as fallback.
--get-color name [default]
Find the color configured for nnaammee (e.g. ccoolloorr..ddiiffff..nneeww) and
output it as the ANSI color escape sequence to the standard output.
The optional ddeeffaauulltt parameter is used instead, if there is no
color configured for nnaammee.
-e, --edit
Opens an editor to modify the specified config file; either
----ssyysstteemm, ----gglloobbaall, or repository (default).
--[no-]includes
Respect iinncclluuddee..** directives in config files when looking up
values. Defaults to ooffff when a specific file is given (e.g., using
----ffiillee, ----gglloobbaall, etc) and oonn when searching all config files.
FFIILLEESS
If not set explicitly with ----ffiillee, there are four files where _g_i_t
_c_o_n_f_i_g will search for configuration options:
$(prefix)/etc/gitconfig
System-wide configuration file.
$XDG_CONFIG_HOME/git/config
Second user-specific configuration file. If $XDG_CONFIG_HOME is not
set or empty, $$HHOOMMEE//..ccoonnffiigg//ggiitt//ccoonnffiigg will be used. Any
single-valued variable set in this file will be overwritten by
whatever is in ~~//..ggiittccoonnffiigg. It is a good idea not to create this
file if you sometimes use older versions of Git, as support for
this file was added fairly recently.
~/.gitconfig
User-specific configuration file. Also called "global"
configuration file.
$GIT_DIR/config
Repository specific configuration file.
If no further options are given, all reading options will read all of
these files that are available. If the global or the system-wide
configuration file are not available they will be ignored. If the
repository configuration file is not available or readable, _g_i_t _c_o_n_f_i_g
will exit with a non-zero error code. However, in neither case will an
error message be issued.
The files are read in the order given above, with last value found
taking precedence over values read earlier. When multiple values are
taken then all values of a key from all files will be used.
You may override individual configuration parameters when running any
git command by using the --cc option. See ggiitt(1) for details.
All writing options will per default write to the repository specific
configuration file. Note that this also affects options like
----rreeppllaaccee--aallll and ----uunnsseett. _g_i_t _c_o_n_f_i_g wwiillll oonnllyy eevveerr cchhaannggee oonnee ffiillee aatt
aa ttiimmee.
You can override these rules either by command-line options or by
environment variables. The ----gglloobbaall and the ----ssyysstteemm options will limit
the file used to the global or system-wide file respectively. The
GGIITT__CCOONNFFIIGG environment variable has a similar effect, but you can
specify any filename you want.
EENNVVIIRROONNMMEENNTT
GIT_CONFIG
Take the configuration from the given file instead of .git/config.
Using the "--global" option forces this to ~/.gitconfig. Using the
"--system" option forces this to $(prefix)/etc/gitconfig.
GIT_CONFIG_NOSYSTEM
Whether to skip reading settings from the system-wide
$(prefix)/etc/gitconfig file. See ggiitt(1) for details.
See also the section called “FILES”.
EEXXAAMMPPLLEESS
Given a .git/config like this:
#
# This is the config file, and
# a '#' or ';' character indicates
# a comment
#
; core variables
[core]
; Don't trust file modes
filemode = false
; Our diff algorithm
[diff]
external = /usr/local/bin/diff-wrapper
renames = true
; Proxy settings
[core]
gitproxy=proxy-command for kernel.org
gitproxy=default-proxy ; for all the rest
; HTTP
[http]
sslVerify
[http "https://weak.example.com"]
sslVerify = false
cookieFile = /tmp/cookie.txt
you can set the filemode to true with
% git config core.filemode true
The hypothetical proxy command entries actually have a postfix to
discern what URL they apply to. Here is how to change the entry for
kernel.org to "ssh".
% git config core.gitproxy '"ssh" for kernel.org' 'for kernel.org$'
This makes sure that only the key/value pair for kernel.org is
replaced.
To delete the entry for renames, do
% git config --unset diff.renames
If you want to delete an entry for a multivar (like core.gitproxy
above), you have to provide a regex matching the value of exactly one
line.
To query the value for a given key, do
% git config --get core.filemode
or
% git config core.filemode
or, to query a multivar:
% git config --get core.gitproxy "for kernel.org$"
If you want to know all the values for a multivar, do:
% git config --get-all core.gitproxy
If you like to live dangerously, you can replace aallll core.gitproxy by a
new one with
% git config --replace-all core.gitproxy ssh
However, if you really only want to replace the line for the default
proxy, i.e. the one without a "for ..." postfix, do something like
this:
% git config core.gitproxy ssh '! for '
To actually match only values with an exclamation mark, you have to
% git config section.key value '[!]'
To add a new proxy, without altering any of the existing ones, use
% git config --add core.gitproxy '"proxy-command" for example.com'
An example to use customized color from the configuration in your
script:
#!/bin/sh
WS=$(git config --get-color color.diff.whitespace "blue reverse")
RESET=$(git config --get-color "" "reset")
echo "${WS}your whitespace color or blue reverse${RESET}"
For URLs in hhttttppss::////wweeaakk..eexxaammppllee..ccoomm, hhttttpp..ssssllVVeerriiffyy is set to false,
while it is set to ttrruuee for all others:
% git config --bool --get-urlmatch http.sslverify https://good.example.com
true
% git config --bool --get-urlmatch http.sslverify https://weak.example.com
false
% git config --get-urlmatch http https://weak.example.com
http.cookieFile /tmp/cookie.txt
http.sslverify false
CCOONNFFIIGGUURRAATTIIOONN FFIILLEE
The Git configuration file contains a number of variables that affect
the Git commands' behavior. The ..ggiitt//ccoonnffiigg file in each repository is
used to store the configuration for that repository, and
$$HHOOMMEE//..ggiittccoonnffiigg is used to store a per-user configuration as fallback
values for the ..ggiitt//ccoonnffiigg file. The file //eettcc//ggiittccoonnffiigg can be used to
store a system-wide default configuration.
The configuration variables are used by both the Git plumbing and the
porcelains. The variables are divided into sections, wherein the fully
qualified variable name of the variable itself is the last
dot-separated segment and the section name is everything before the
last dot. The variable names are case-insensitive, allow only
alphanumeric characters and --, and must start with an alphabetic
character. Some variables may appear multiple times; we say then that
the variable is multivalued.
SSyynnttaaxx
The syntax is fairly flexible and permissive; whitespaces are mostly
ignored. The _# and _; characters begin comments to the end of line,
blank lines are ignored.
The file consists of sections and variables. A section begins with the
name of the section in square brackets and continues until the next
section begins. Section names are case-insensitive. Only alphanumeric
characters, -- and .. are allowed in section names. Each variable must
belong to some section, which means that there must be a section header
before the first setting of a variable.
Sections can be further divided into subsections. To begin a subsection
put its name in double quotes, separated by space from the section
name, in the section header, like in the example below:
[section "subsection"]
Subsection names are case sensitive and can contain any characters
except newline (doublequote "" and backslash can be included by escaping
them as \\"" and \\\\, respectively). Section headers cannot span multiple
lines. Variables may belong directly to a section or to a given
subsection. You can have [[sseeccttiioonn]] if you have [[sseeccttiioonn ""ssuubbsseeccttiioonn""]],
but you don’t need to.
There is also a deprecated [[sseeccttiioonn..ssuubbsseeccttiioonn]] syntax. With this
syntax, the subsection name is converted to lower-case and is also
compared case sensitively. These subsection names follow the same
restrictions as section names.
All the other lines (and the remainder of the line after the section
header) are recognized as setting variables, in the form _n_a_m_e _= _v_a_l_u_e
(or just _n_a_m_e, which is a short-hand to say that the variable is the
boolean "true"). The variable names are case-insensitive, allow only
alphanumeric characters and --, and must start with an alphabetic
character.
A line that defines a value can be continued to the next line by ending
it with a \\; the backquote and the end-of-line are stripped. Leading
whitespaces after _n_a_m_e _=, the remainder of the line after the first
comment character _# or _;, and trailing whitespaces of the line are
discarded unless they are enclosed in double quotes. Internal
whitespaces within the value are retained verbatim.
Inside double quotes, double quote "" and backslash \\ characters must be
escaped: use \\"" for "" and \\\\ for \\.
The following escape sequences (beside \\"" and \\\\) are recognized: \\nn
for newline character (NL), \\tt for horizontal tabulation (HT, TAB) and
\\bb for backspace (BS). Other char escape sequences (including octal
escape sequences) are invalid.
IInncclluuddeess
The iinncclluuddee and iinncclluuddeeIIff sections allow you to include config
directives from another source. These sections behave identically to
each other with the exception that iinncclluuddeeIIff sections may be ignored if
their condition does not evaluate to true; see "Conditional includes"
below.
You can include a config file from another by setting the special
iinncclluuddee..ppaatthh (or iinncclluuddeeIIff..**..ppaatthh) variable to the name of the file to
be included. The variable takes a pathname as its value, and is subject
to tilde expansion. These variables can be given multiple times.
The contents of the included file are inserted immediately, as if they
had been found at the location of the include directive. If the value
of the variable is a relative path, the path is considered to be
relative to the configuration file in which the include directive was
found. See below for examples.
CCoonnddiittiioonnaall iinncclluuddeess
You can include a config file from another conditionally by setting a
iinncclluuddeeIIff..<<ccoonnddiittiioonn>>..ppaatthh variable to the name of the file to be
included.
The condition starts with a keyword followed by a colon and some data
whose format and meaning depends on the keyword. Supported keywords
are:
ggiittddiirr
The data that follows the keyword ggiittddiirr:: is used as a glob
pattern. If the location of the .git directory matches the pattern,
the include condition is met.
The .git location may be auto-discovered, or come from $$GGIITT__DDIIRR
environment variable. If the repository is auto discovered via a
.git file (e.g. from submodules, or a linked worktree), the .git
location would be the final location where the .git directory is,
not where the .git file is.
The pattern can contain standard globbing wildcards and two
additional ones, ****// and //****, that can match multiple path
components. Please refer to ggiittiiggnnoorree(5) for details. For
convenience:
· If the pattern starts with ~~//, ~~ will be substituted with the
content of the environment variable HHOOMMEE.
· If the pattern starts with ..//, it is replaced with the
directory containing the current config file.
· If the pattern does not start with either ~~//, ..// or //, ****// will
be automatically prepended. For example, the pattern ffoooo//bbaarr
becomes ****//ffoooo//bbaarr and would match //aannyy//ppaatthh//ttoo//ffoooo//bbaarr.
· If the pattern ends with //, **** will be automatically added. For
example, the pattern ffoooo// becomes ffoooo//****. In other words, it
matches "foo" and everything inside, recursively.
ggiittddiirr//ii
This is the same as ggiittddiirr except that matching is done
case-insensitively (e.g. on case-insensitive file sytems)
A few more notes on matching via ggiittddiirr and ggiittddiirr//ii:
· Symlinks in $$GGIITT__DDIIRR are not resolved before matching.
· Note that "../" is not special and will match literally, which is
unlikely what you want.
EExxaammppllee
# Core variables
[core]
; Don't trust file modes
filemode = false
# Our diff algorithm
[diff]
external = /usr/local/bin/diff-wrapper
renames = true
[branch "devel"]
remote = origin
merge = refs/heads/devel
# Proxy settings
[core]
gitProxy="ssh" for "kernel.org"
gitProxy=default-proxy ; for the rest
[include]
path = /path/to/foo.inc ; include by absolute path
path = foo.inc ; find "foo.inc" relative to the current file
path = ~/foo.inc ; find "foo.inc" in your `$HOME` directory
; include if $GIT_DIR is /path/to/foo/.git
[includeIf "gitdir:/path/to/foo/.git"]
path = /path/to/foo.inc
; include for all repositories inside /path/to/group
[includeIf "gitdir:/path/to/group/"]
path = /path/to/foo.inc
; include for all repositories inside $HOME/to/group
[includeIf "gitdir:~/to/group/"]
path = /path/to/foo.inc
; relative paths are always relative to the including
; file (if the condition is true); their location is not
; affected by the condition
[includeIf "gitdir:/path/to/group/"]
path = foo.inc
VVaalluueess
Values of many variables are treated as a simple string, but there are
variables that take values of specific types and there are rules as to
how to spell them.
boolean
When a variable is said to take a boolean value, many synonyms are
accepted for _t_r_u_e and _f_a_l_s_e; these are all case-insensitive.
true
Boolean true can be spelled as yyeess, oonn, ttrruuee, or 11. Also, a
variable defined without == <<vvaalluuee>> is taken as true.
false
Boolean false can be spelled as nnoo, ooffff, ffaallssee, or 00.
When converting value to the canonical form using ----bbooooll type
specifier; _g_i_t _c_o_n_f_i_g will ensure that the output is "true" or
"false" (spelled in lowercase).
integer
The value for many variables that specify various sizes can be
suffixed with kk, MM,... to mean "scale the number by 1024", "by
1024x1024", etc.
color
The value for a variable that takes a color is a list of colors (at
most two, one for foreground and one for background) and attributes
(as many as you want), separated by spaces.
The basic colors accepted are nnoorrmmaall, bbllaacckk, rreedd, ggrreeeenn, yyeellllooww,
bblluuee, mmaaggeennttaa, ccyyaann and wwhhiittee. The first color given is the
foreground; the second is the background.
Colors may also be given as numbers between 0 and 255; these use
ANSI 256-color mode (but note that not all terminals may support
this). If your terminal supports it, you may also specify 24-bit
RGB values as hex, like ##ffff00aabb33.
The accepted attributes are bboolldd, ddiimm, uull, bblliinnkk, rreevveerrssee, iittaalliicc,
and ssttrriikkee (for crossed-out or "strikethrough" letters). The
position of any attributes with respect to the colors (before,
after, or in between), doesn’t matter. Specific attributes may be
turned off by prefixing them with nnoo or nnoo-- (e.g., nnoorreevveerrssee,
nnoo--uull, etc).
An empty color string produces no color effect at all. This can be
used to avoid coloring specific elements without disabling color
entirely.
For git’s pre-defined color slots, the attributes are meant to be
reset at the beginning of each item in the colored output. So
setting ccoolloorr..ddeeccoorraattee..bbrraanncchh to bbllaacckk will paint that branch name
in a plain bbllaacckk, even if the previous thing on the same output
line (e.g. opening parenthesis before the list of branch names in
lloogg ----ddeeccoorraattee output) is set to be painted with bboolldd or some other
attribute. However, custom log formats may do more complicated and
layered coloring, and the negated forms may be useful there.
pathname
A variable that takes a pathname value can be given a string that
begins with "~~//" or "~~uusseerr//", and the usual tilde expansion happens
to such a string: ~~// is expanded to the value of $$HHOOMMEE, and ~~uusseerr//
to the specified user’s home directory.
VVaarriiaabblleess
Note that this list is non-comprehensive and not necessarily complete.
For command-specific variables, you will find a more detailed
description in the appropriate manual page.
Other git-related tools may and do use their own variables. When
inventing new variables for use in your own tool, make sure their names
do not conflict with those that are used by Git itself and other
popular tools, and describe them in your documentation.
advice.*
These variables control various optional help messages designed to
aid new users. All _a_d_v_i_c_e_._* variables default to _t_r_u_e, and you can
tell Git that you do not need help by setting these to _f_a_l_s_e:
pushUpdateRejected
Set this variable to _f_a_l_s_e if you want to disable
_p_u_s_h_N_o_n_F_F_C_u_r_r_e_n_t, _p_u_s_h_N_o_n_F_F_M_a_t_c_h_i_n_g, _p_u_s_h_A_l_r_e_a_d_y_E_x_i_s_t_s,
_p_u_s_h_F_e_t_c_h_F_i_r_s_t, and _p_u_s_h_N_e_e_d_s_F_o_r_c_e simultaneously.
pushNonFFCurrent
Advice shown when ggiitt--ppuusshh(1) fails due to a non-fast-forward
update to the current branch.
pushNonFFMatching
Advice shown when you ran ggiitt--ppuusshh(1) and pushed _m_a_t_c_h_i_n_g _r_e_f_s
explicitly (i.e. you used _:, or specified a refspec that isn’t
your current branch) and it resulted in a non-fast-forward
error.
pushAlreadyExists
Shown when ggiitt--ppuusshh(1) rejects an update that does not qualify
for fast-forwarding (e.g., a tag.)
pushFetchFirst
Shown when ggiitt--ppuusshh(1) rejects an update that tries to
overwrite a remote ref that points at an object we do not have.
pushNeedsForce
Shown when ggiitt--ppuusshh(1) rejects an update that tries to
overwrite a remote ref that points at an object that is not a
commit-ish, or make the remote ref point at an object that is
not a commit-ish.
statusHints
Show directions on how to proceed from the current state in the
output of ggiitt--ssttaattuuss(1), in the template shown when writing
commit messages in ggiitt--ccoommmmiitt(1), and in the help message shown
by ggiitt--cchheecckkoouutt(1) when switching branch.
statusUoption
Advise to consider using the --uu option to ggiitt--ssttaattuuss(1) when
the command takes more than 2 seconds to enumerate untracked
files.
commitBeforeMerge
Advice shown when ggiitt--mmeerrggee(1) refuses to merge to avoid
overwriting local changes.
resolveConflict
Advice shown by various commands when conflicts prevent the
operation from being performed.
implicitIdentity
Advice on how to set your identity configuration when your
information is guessed from the system username and domain
name.
detachedHead
Advice shown when you used ggiitt--cchheecckkoouutt(1) to move to the
detach HEAD state, to instruct how to create a local branch
after the fact.
amWorkDir
Advice that shows the location of the patch file when ggiitt--aamm(1)
fails to apply it.
rmHints
In case of failure in the output of ggiitt--rrmm(1), show directions
on how to proceed from the current state.
core.fileMode
Tells Git if the executable bit of files in the working tree is to
be honored.
Some filesystems lose the executable bit when a file that is marked
as executable is checked out, or checks out a non-executable file
with executable bit on. ggiitt--cclloonnee(1) or ggiitt--iinniitt(1) probe the
filesystem to see if it handles the executable bit correctly and
this variable is automatically set as necessary.
A repository, however, may be on a filesystem that handles the
filemode correctly, and this variable is set to _t_r_u_e when created,
but later may be made accessible from another environment that
loses the filemode (e.g. exporting ext4 via CIFS mount, visiting a
Cygwin created repository with Git for Windows or Eclipse). In such
a case it may be necessary to set this variable to _f_a_l_s_e. See ggiitt--
uuppddaattee--iinnddeexx(1).
The default is true (when core.filemode is not specified in the
config file).
core.hideDotFiles
(Windows-only) If true, mark newly-created directories and files
whose name starts with a dot as hidden. If _d_o_t_G_i_t_O_n_l_y, only the
..ggiitt// directory is hidden, but no other files starting with a dot.
The default mode is _d_o_t_G_i_t_O_n_l_y.
core.ignoreCase
If true, this option enables various workarounds to enable Git to
work better on filesystems that are not case sensitive, like FAT.
For example, if a directory listing finds "makefile" when Git
expects "Makefile", Git will assume it is really the same file, and
continue to remember it as "Makefile".
The default is false, except ggiitt--cclloonnee(1) or ggiitt--iinniitt(1) will probe
and set core.ignoreCase true if appropriate when the repository is
created.
core.precomposeUnicode
This option is only used by Mac OS implementation of Git. When
core.precomposeUnicode=true, Git reverts the unicode decomposition
of filenames done by Mac OS. This is useful when sharing a
repository between Mac OS and Linux or Windows. (Git for Windows
1.7.10 or higher is needed, or Git under cygwin 1.7). When false,
file names are handled fully transparent by Git, which is backward
compatible with older versions of Git.
core.protectHFS
If set to true, do not allow checkout of paths that would be
considered equivalent to ..ggiitt on an HFS+ filesystem. Defaults to
ttrruuee on Mac OS, and ffaallssee elsewhere.
core.protectNTFS
If set to true, do not allow checkout of paths that would cause
problems with the NTFS filesystem, e.g. conflict with 8.3 "short"
names. Defaults to ttrruuee on Windows, and ffaallssee elsewhere.
core.trustctime
If false, the ctime differences between the index and the working
tree are ignored; useful when the inode change time is regularly
modified by something outside Git (file system crawlers and some
backup systems). See ggiitt--uuppddaattee--iinnddeexx(1). True by default.
core.splitIndex
If true, the split-index feature of the index will be used. See
ggiitt--uuppddaattee--iinnddeexx(1). False by default.
core.untrackedCache
Determines what to do about the untracked cache feature of the
index. It will be kept, if this variable is unset or set to kkeeeepp.
It will automatically be added if set to ttrruuee. And it will
automatically be removed, if set to ffaallssee. Before setting it to
ttrruuee, you should check that mtime is working properly on your
system. See ggiitt--uuppddaattee--iinnddeexx(1). kkeeeepp by default.
core.checkStat
Determines which stat fields to match between the index and work
tree. The user can set this to _d_e_f_a_u_l_t or _m_i_n_i_m_a_l. Default (or
explicitly _d_e_f_a_u_l_t), is to check all fields, including the
sub-second part of mtime and ctime.
core.quotePath
Commands that output paths (e.g. _l_s_-_f_i_l_e_s, _d_i_f_f), will quote
"unusual" characters in the pathname by enclosing the pathname in
double-quotes and escaping those characters with backslashes in the
same way C escapes control characters (e.g. \\tt for TAB, \\nn for LF,
\\\\ for backslash) or bytes with values larger than 0x80 (e.g. octal
\\330022\\226655 for "micro" in UTF-8). If this variable is set to false,
bytes higher than 0x80 are not considered "unusual" any more.
Double-quotes, backslash and control characters are always escaped
regardless of the setting of this variable. A simple space
character is not considered "unusual". Many commands can output
pathnames completely verbatim using the --zz option. The default
value is true.
core.eol
Sets the line ending type to use in the working directory for files
that have the tteexxtt property set when core.autocrlf is false.
Alternatives are _l_f, _c_r_l_f and _n_a_t_i_v_e, which uses the platform’s
native line ending. The default value is nnaattiivvee. See
ggiittaattttrriibbuutteess(5) for more information on end-of-line conversion.
core.safecrlf
If true, makes Git check if converting CCRRLLFF is reversible when
end-of-line conversion is active. Git will verify if a command
modifies a file in the work tree either directly or indirectly. For
example, committing a file followed by checking out the same file
should yield the original file in the work tree. If this is not the
case for the current setting of ccoorree..aauuttooccrrllff, Git will reject the
file. The variable can be set to "warn", in which case Git will
only warn about an irreversible conversion but continue the
operation.
CRLF conversion bears a slight chance of corrupting data. When it
is enabled, Git will convert CRLF to LF during commit and LF to
CRLF during checkout. A file that contains a mixture of LF and CRLF
before the commit cannot be recreated by Git. For text files this
is the right thing to do: it corrects line endings such that we
have only LF line endings in the repository. But for binary files
that are accidentally classified as text the conversion can corrupt
data.
If you recognize such corruption early you can easily fix it by
setting the conversion type explicitly in .gitattributes. Right
after committing you still have the original file in your work tree
and this file is not yet corrupted. You can explicitly tell Git
that this file is binary and Git will handle the file
appropriately.
Unfortunately, the desired effect of cleaning up text files with
mixed line endings and the undesired effect of corrupting binary
files cannot be distinguished. In both cases CRLFs are removed in
an irreversible way. For text files this is the right thing to do
because CRLFs are line endings, while for binary files converting
CRLFs corrupts data.
Note, this safety check does not mean that a checkout will generate
a file identical to the original file for a different setting of
ccoorree..eeooll and ccoorree..aauuttooccrrllff, but only for the current one. For
example, a text file with LLFF would be accepted with ccoorree..eeooll==llff and
could later be checked out with ccoorree..eeooll==ccrrllff, in which case the
resulting file would contain CCRRLLFF, although the original file
contained LLFF. However, in both work trees the line endings would be
consistent, that is either all LLFF or all CCRRLLFF, but never mixed. A
file with mixed line endings would be reported by the ccoorree..ssaaffeeccrrllff
mechanism.
core.autocrlf
Setting this variable to "true" is the same as setting the tteexxtt
attribute to "auto" on all files and core.eol to "crlf". Set to
true if you want to have CCRRLLFF line endings in your working
directory and the repository has LF line endings. This variable can
be set to _i_n_p_u_t, in which case no output conversion is performed.
core.symlinks
If false, symbolic links are checked out as small plain files that
contain the link text. ggiitt--uuppddaattee--iinnddeexx(1) and ggiitt--aadddd(1) will not
change the recorded type to regular file. Useful on filesystems
like FAT that do not support symbolic links.
The default is true, except ggiitt--cclloonnee(1) or ggiitt--iinniitt(1) will probe
and set core.symlinks false if appropriate when the repository is
created.
core.gitProxy
A "proxy command" to execute (as _c_o_m_m_a_n_d _h_o_s_t _p_o_r_t) instead of
establishing direct connection to the remote server when using the
Git protocol for fetching. If the variable value is in the "COMMAND
for DOMAIN" format, the command is applied only on hostnames ending
with the specified domain string. This variable may be set multiple
times and is matched in the given order; the first match wins.
Can be overridden by the GGIITT__PPRROOXXYY__CCOOMMMMAANNDD environment variable
(which always applies universally, without the special "for"
handling).
The special string nnoonnee can be used as the proxy command to specify
that no proxy be used for a given domain pattern. This is useful
for excluding servers inside a firewall from proxy use, while
defaulting to a common proxy for external domains.
core.sshCommand
If this variable is set, ggiitt ffeettcchh and ggiitt ppuusshh will use the
specified command instead of sssshh when they need to connect to a
remote system. The command is in the same form as the
GGIITT__SSSSHH__CCOOMMMMAANNDD environment variable and is overridden when the
environment variable is set.
core.ignoreStat
If true, Git will avoid using lstat() calls to detect if files have
changed by setting the "assume-unchanged" bit for those tracked
files which it has updated identically in both the index and
working tree.
When files are modified outside of Git, the user will need to stage
the modified files explicitly (e.g. see _E_x_a_m_p_l_e_s section in ggiitt--
uuppddaattee--iinnddeexx(1)). Git will not normally detect changes to those
files.
This is useful on systems where lstat() calls are very slow, such
as CIFS/Microsoft Windows.
False by default.
core.preferSymlinkRefs
Instead of the default "symref" format for HEAD and other symbolic
reference files, use symbolic links. This is sometimes needed to
work with old scripts that expect HEAD to be a symbolic link.
core.bare
If true this repository is assumed to be _b_a_r_e and has no working
directory associated with it. If this is the case a number of
commands that require a working directory will be disabled, such as
ggiitt--aadddd(1) or ggiitt--mmeerrggee(1).
This setting is automatically guessed by ggiitt--cclloonnee(1) or ggiitt--
iinniitt(1) when the repository was created. By default a repository
that ends in "/.git" is assumed to be not bare (bare = false),
while all other repositories are assumed to be bare (bare = true).
core.worktree
Set the path to the root of the working tree. If GGIITT__CCOOMMMMOONN__DDIIRR
environment variable is set, core.worktree is ignored and not used
for determining the root of working tree. This can be overridden by
the GGIITT__WWOORRKK__TTRREEEE environment variable and the ----wwoorrkk--ttrreeee
command-line option. The value can be an absolute path or relative
to the path to the .git directory, which is either specified by
--git-dir or GIT_DIR, or automatically discovered. If --git-dir or
GIT_DIR is specified but none of --work-tree, GIT_WORK_TREE and
core.worktree is specified, the current working directory is
regarded as the top level of your working tree.
Note that this variable is honored even when set in a configuration
file in a ".git" subdirectory of a directory and its value differs
from the latter directory (e.g. "/path/to/.git/config" has
core.worktree set to "/different/path"), which is most likely a
misconfiguration. Running Git commands in the "/path/to" directory
will still use "/different/path" as the root of the work tree and
can cause confusion unless you know what you are doing (e.g. you
are creating a read-only snapshot of the same index to a location
different from the repository’s usual working tree).
core.logAllRefUpdates
Enable the reflog. Updates to a ref <ref> is logged to the file
"$$GGIITT__DDIIRR//llooggss//<<rreeff>>", by appending the new and old SHA-1, the
date/time and the reason of the update, but only when the file
exists. If this configuration variable is set to ttrruuee, missing
"$$GGIITT__DDIIRR//llooggss//<<rreeff>>" file is automatically created for branch
heads (i.e. under rreeffss//hheeaaddss//), remote refs (i.e. under
rreeffss//rreemmootteess//), note refs (i.e. under rreeffss//nnootteess//), and the
symbolic ref HHEEAADD. If it is set to aallwwaayyss, then a missing reflog is
automatically created for any ref under rreeffss//.
This information can be used to determine what commit was the tip
of a branch "2 days ago".
This value is true by default in a repository that has a working
directory associated with it, and false by default in a bare
repository.
core.repositoryFormatVersion
Internal variable identifying the repository format and layout
version.
core.sharedRepository
When _g_r_o_u_p (or _t_r_u_e), the repository is made shareable between
several users in a group (making sure all the files and objects are
group-writable). When _a_l_l (or _w_o_r_l_d or _e_v_e_r_y_b_o_d_y), the repository
will be readable by all users, additionally to being
group-shareable. When _u_m_a_s_k (or _f_a_l_s_e), Git will use permissions
reported by umask(2). When _0_x_x_x, where _0_x_x_x is an octal number,
files in the repository will have this mode value. _0_x_x_x will
override user’s umask value (whereas the other options will only
override requested parts of the user’s umask value). Examples: _0_6_6_0
will make the repo read/write-able for the owner and group, but
inaccessible to others (equivalent to _g_r_o_u_p unless umask is e.g.
_0_0_2_2). _0_6_4_0 is a repository that is group-readable but not
group-writable. See ggiitt--iinniitt(1). False by default.
core.warnAmbiguousRefs
If true, Git will warn you if the ref name you passed it is
ambiguous and might match multiple refs in the repository. True by
default.
core.compression
An integer -1..9, indicating a default compression level. -1 is the
zlib default. 0 means no compression, and 1..9 are various
speed/size tradeoffs, 9 being slowest. If set, this provides a
default to other compression variables, such as
ccoorree..lloooosseeCCoommpprreessssiioonn and ppaacckk..ccoommpprreessssiioonn.
core.looseCompression
An integer -1..9, indicating the compression level for objects that
are not in a pack file. -1 is the zlib default. 0 means no
compression, and 1..9 are various speed/size tradeoffs, 9 being
slowest. If not set, defaults to core.compression. If that is not
set, defaults to 1 (best speed).
core.packedGitWindowSize
Number of bytes of a pack file to map into memory in a single
mapping operation. Larger window sizes may allow your system to
process a smaller number of large pack files more quickly. Smaller
window sizes will negatively affect performance due to increased
calls to the operating system’s memory manager, but may improve
performance when accessing a large number of large pack files.
Default is 1 MiB if NO_MMAP was set at compile time, otherwise 32
MiB on 32 bit platforms and 1 GiB on 64 bit platforms. This should
be reasonable for all users/operating systems. You probably do not
need to adjust this value.
Common unit suffixes of _k, _m, or _g are supported.
core.packedGitLimit
Maximum number of bytes to map simultaneously into memory from pack
files. If Git needs to access more than this many bytes at once to
complete an operation it will unmap existing regions to reclaim
virtual address space within the process.
Default is 256 MiB on 32 bit platforms and 8 GiB on 64 bit
platforms. This should be reasonable for all users/operating
systems, except on the largest projects. You probably do not need
to adjust this value.
Common unit suffixes of _k, _m, or _g are supported.
core.deltaBaseCacheLimit
Maximum number of bytes to reserve for caching base objects that
may be referenced by multiple deltified objects. By storing the
entire decompressed base objects in a cache Git is able to avoid
unpacking and decompressing frequently used base objects multiple
times.
Default is 96 MiB on all platforms. This should be reasonable for
all users/operating systems, except on the largest projects. You
probably do not need to adjust this value.
Common unit suffixes of _k, _m, or _g are supported.
core.bigFileThreshold
Files larger than this size are stored deflated, without attempting
delta compression. Storing large files without delta compression
avoids excessive memory usage, at the slight expense of increased
disk usage. Additionally files larger than this size are always
treated as binary.
Default is 512 MiB on all platforms. This should be reasonable for
most projects as source code and other text files can still be
delta compressed, but larger binary media files won’t be.
Common unit suffixes of _k, _m, or _g are supported.
core.excludesFile
Specifies the pathname to the file that contains patterns to
describe paths that are not meant to be tracked, in addition to
_._g_i_t_i_g_n_o_r_e (per-directory) and _._g_i_t_/_i_n_f_o_/_e_x_c_l_u_d_e. Defaults to
$$XXDDGG__CCOONNFFIIGG__HHOOMMEE//ggiitt//iiggnnoorree. If $$XXDDGG__CCOONNFFIIGG__HHOOMMEE is either not set
or empty, $$HHOOMMEE//..ccoonnffiigg//ggiitt//iiggnnoorree is used instead. See
ggiittiiggnnoorree(5).
core.askPass
Some commands (e.g. svn and http interfaces) that interactively ask
for a password can be told to use an external program given via the
value of this variable. Can be overridden by the GGIITT__AASSKKPPAASSSS
environment variable. If not set, fall back to the value of the
SSSSHH__AASSKKPPAASSSS environment variable or, failing that, a simple
password prompt. The external program shall be given a suitable
prompt as command-line argument and write the password on its
STDOUT.
core.attributesFile
In addition to _._g_i_t_a_t_t_r_i_b_u_t_e_s (per-directory) and
_._g_i_t_/_i_n_f_o_/_a_t_t_r_i_b_u_t_e_s, Git looks into this file for attributes (see
ggiittaattttrriibbuutteess(5)). Path expansions are made the same way as for
ccoorree..eexxcclluuddeessFFiillee. Its default value is
$$XXDDGG__CCOONNFFIIGG__HHOOMMEE//ggiitt//aattttrriibbuutteess. If $$XXDDGG__CCOONNFFIIGG__HHOOMMEE is either not
set or empty, $$HHOOMMEE//..ccoonnffiigg//ggiitt//aattttrriibbuutteess is used instead.
core.hooksPath
By default Git will look for your hooks in the _$_G_I_T___D_I_R_/_h_o_o_k_s
directory. Set this to different path, e.g. _/_e_t_c_/_g_i_t_/_h_o_o_k_s, and
Git will try to find your hooks in that directory, e.g.
_/_e_t_c_/_g_i_t_/_h_o_o_k_s_/_p_r_e_-_r_e_c_e_i_v_e instead of in
_$_G_I_T___D_I_R_/_h_o_o_k_s_/_p_r_e_-_r_e_c_e_i_v_e.
The path can be either absolute or relative. A relative path is
taken as relative to the directory where the hooks are run (see the
"DESCRIPTION" section of ggiitthhooookkss(5)).
This configuration variable is useful in cases where you’d like to
centrally configure your Git hooks instead of configuring them on a
per-repository basis, or as a more flexible and centralized
alternative to having an iinniitt..tteemmppllaatteeDDiirr where you’ve changed
default hooks.
core.editor
Commands such as ccoommmmiitt and ttaagg that let you edit messages by
launching an editor use the value of this variable when it is set,
and the environment variable GGIITT__EEDDIITTOORR is not set. See ggiitt--vvaarr(1).
core.commentChar
Commands such as ccoommmmiitt and ttaagg that let you edit messages consider
a line that begins with this character commented, and removes them
after the editor returns (default _#).
If set to "auto", ggiitt--ccoommmmiitt would select a character that is not
the beginning character of any line in existing commit messages.
core.packedRefsTimeout
The length of time, in milliseconds, to retry when trying to lock
the ppaacckkeedd--rreeffss file. Value 0 means not to retry at all; -1 means
to try indefinitely. Default is 1000 (i.e., retry for 1 second).
sequence.editor
Text editor used by ggiitt rreebbaassee --ii for editing the rebase
instruction file. The value is meant to be interpreted by the shell
when it is used. It can be overridden by the GGIITT__SSEEQQUUEENNCCEE__EEDDIITTOORR
environment variable. When not configured the default commit
message editor is used instead.
core.pager
Text viewer for use by Git commands (e.g., _l_e_s_s). The value is
meant to be interpreted by the shell. The order of preference is
the $$GGIITT__PPAAGGEERR environment variable, then ccoorree..ppaaggeerr configuration,
then $$PPAAGGEERR, and then the default chosen at compile time (usually
_l_e_s_s).
When the LLEESSSS environment variable is unset, Git sets it to FFRRXX (if
LLEESSSS environment variable is set, Git does not change it at all).
If you want to selectively override Git’s default setting for LLEESSSS,
you can set ccoorree..ppaaggeerr to e.g. lleessss --SS. This will be passed to the
shell by Git, which will translate the final command to LLEESSSS==FFRRXX
lleessss --SS. The environment does not set the SS option but the command
line does, instructing less to truncate long lines. Similarly,
setting ccoorree..ppaaggeerr to lleessss --++FF will deactivate the FF option
specified by the environment from the command-line, deactivating
the "quit if one screen" behavior of lleessss. One can specifically
activate some flags for particular commands: for example, setting
ppaaggeerr..bbllaammee to lleessss --SS enables line truncation only for ggiitt bbllaammee.
Likewise, when the LLVV environment variable is unset, Git sets it to
--cc. You can override this setting by exporting LLVV with another
value or setting ccoorree..ppaaggeerr to llvv ++cc.
core.whitespace
A comma separated list of common whitespace problems to notice.
_g_i_t _d_i_f_f will use ccoolloorr..ddiiffff..wwhhiitteessppaaccee to highlight them, and _g_i_t
_a_p_p_l_y _-_-_w_h_i_t_e_s_p_a_c_e_=_e_r_r_o_r will consider them as errors. You can
prefix -- to disable any of them (e.g. --ttrraaiilliinngg--ssppaaccee):
· bbllaannkk--aatt--eeooll treats trailing whitespaces at the end of the line
as an error (enabled by default).
· ssppaaccee--bbeeffoorree--ttaabb treats a space character that appears
immediately before a tab character in the initial indent part
of the line as an error (enabled by default).
· iinnddeenntt--wwiitthh--nnoonn--ttaabb treats a line that is indented with space
characters instead of the equivalent tabs as an error (not
enabled by default).
· ttaabb--iinn--iinnddeenntt treats a tab character in the initial indent part
of the line as an error (not enabled by default).
· bbllaannkk--aatt--eeooff treats blank lines added at the end of file as an
error (enabled by default).
· ttrraaiilliinngg--ssppaaccee is a short-hand to cover both bbllaannkk--aatt--eeooll and
bbllaannkk--aatt--eeooff.
· ccrr--aatt--eeooll treats a carriage-return at the end of line as part
of the line terminator, i.e. with it, ttrraaiilliinngg--ssppaaccee does not
trigger if the character before such a carriage-return is not a
whitespace (not enabled by default).
· ttaabbwwiiddtthh==<<nn>> tells how many character positions a tab occupies;
this is relevant for iinnddeenntt--wwiitthh--nnoonn--ttaabb and when Git fixes
ttaabb--iinn--iinnddeenntt errors. The default tab width is 8. Allowed
values are 1 to 63.
core.fsyncObjectFiles
This boolean will enable _f_s_y_n_c_(_) when writing object files.
This is a total waste of time and effort on a filesystem that
orders data writes properly, but can be useful for filesystems that
do not use journalling (traditional UNIX filesystems) or that only
journal metadata and not file contents (OS X’s HFS+, or Linux ext3
with "data=writeback").
core.preloadIndex
Enable parallel index preload for operations like _g_i_t _d_i_f_f
This can speed up operations like _g_i_t _d_i_f_f and _g_i_t _s_t_a_t_u_s
especially on filesystems like NFS that have weak caching semantics
and thus relatively high IO latencies. When enabled, Git will do
the index comparison to the filesystem data in parallel, allowing
overlapping IO’s. Defaults to true.
core.createObject
You can set this to _l_i_n_k, in which case a hardlink followed by a
delete of the source are used to make sure that object creation
will not overwrite existing objects.
On some file system/operating system combinations, this is
unreliable. Set this config setting to _r_e_n_a_m_e there; However, This
will remove the check that makes sure that existing object files
will not get overwritten.
core.notesRef
When showing commit messages, also show notes which are stored in
the given ref. The ref must be fully qualified. If the given ref
does not exist, it is not an error but means that no notes should
be printed.
This setting defaults to "refs/notes/commits", and it can be
overridden by the GGIITT__NNOOTTEESS__RREEFF environment variable. See ggiitt--
nnootteess(1).
core.sparseCheckout
Enable "sparse checkout" feature. See section "Sparse checkout" in
ggiitt--rreeaadd--ttrreeee(1) for more information.
core.abbrev
Set the length object names are abbreviated to. If unspecified or
set to "auto", an appropriate value is computed based on the
approximate number of packed objects in your repository, which
hopefully is enough for abbreviated object names to stay unique for
some time. The minimum length is 4.
add.ignoreErrors, add.ignore-errors (deprecated)
Tells _g_i_t _a_d_d to continue adding files when some files cannot be
added due to indexing errors. Equivalent to the ----iiggnnoorree--eerrrroorrss
option of ggiitt--aadddd(1). aadddd..iiggnnoorree--eerrrroorrss is deprecated, as it does
not follow the usual naming convention for configuration variables.
alias.*
Command aliases for the ggiitt(1) command wrapper - e.g. after
defining "alias.last = cat-file commit HEAD", the invocation "git
last" is equivalent to "git cat-file commit HEAD". To avoid
confusion and troubles with script usage, aliases that hide
existing Git commands are ignored. Arguments are split by spaces,
the usual shell quoting and escaping is supported. A quote pair or
a backslash can be used to quote them.
If the alias expansion is prefixed with an exclamation point, it
will be treated as a shell command. For example, defining
"alias.new = !gitk --all --not ORIG_HEAD", the invocation "git new"
is equivalent to running the shell command "gitk --all --not
ORIG_HEAD". Note that shell commands will be executed from the
top-level directory of a repository, which may not necessarily be
the current directory. GGIITT__PPRREEFFIIXX is set as returned by running
_g_i_t _r_e_v_-_p_a_r_s_e _-_-_s_h_o_w_-_p_r_e_f_i_x from the original current directory.
See ggiitt--rreevv--ppaarrssee(1).
am.keepcr
If true, git-am will call git-mailsplit for patches in mbox format
with parameter ----kkeeeepp--ccrr. In this case git-mailsplit will not
remove \\rr from lines ending with \\rr\\nn. Can be overridden by giving
----nnoo--kkeeeepp--ccrr from the command line. See ggiitt--aamm(1), ggiitt--
mmaaiillsspplliitt(1).
am.threeWay
By default, ggiitt aamm will fail if the patch does not apply cleanly.
When set to true, this setting tells ggiitt aamm to fall back on 3-way
merge if the patch records the identity of blobs it is supposed to
apply to and we have those blobs available locally (equivalent to
giving the ----33wwaayy option from the command line). Defaults to ffaallssee.
See ggiitt--aamm(1).
apply.ignoreWhitespace
When set to _c_h_a_n_g_e, tells _g_i_t _a_p_p_l_y to ignore changes in
whitespace, in the same way as the ----iiggnnoorree--ssppaaccee--cchhaannggee option.
When set to one of: no, none, never, false tells _g_i_t _a_p_p_l_y to
respect all whitespace differences. See ggiitt--aappppllyy(1).
apply.whitespace
Tells _g_i_t _a_p_p_l_y how to handle whitespaces, in the same way as the
----wwhhiitteessppaaccee option. See ggiitt--aappppllyy(1).
branch.autoSetupMerge
Tells _g_i_t _b_r_a_n_c_h and _g_i_t _c_h_e_c_k_o_u_t to set up new branches so that
ggiitt--ppuullll(1) will appropriately merge from the starting point
branch. Note that even if this option is not set, this behavior can
be chosen per-branch using the ----ttrraacckk and ----nnoo--ttrraacckk options. The
valid settings are: ffaallssee — no automatic setup is done; ttrruuee —
automatic setup is done when the starting point is a
remote-tracking branch; aallwwaayyss — automatic setup is done when the
starting point is either a local branch or remote-tracking branch.
This option defaults to true.
branch.autoSetupRebase
When a new branch is created with _g_i_t _b_r_a_n_c_h or _g_i_t _c_h_e_c_k_o_u_t that
tracks another branch, this variable tells Git to set up pull to
rebase instead of merge (see "branch.<name>.rebase"). When nneevveerr,
rebase is never automatically set to true. When llooccaall, rebase is
set to true for tracked branches of other local branches. When
rreemmoottee, rebase is set to true for tracked branches of
remote-tracking branches. When aallwwaayyss, rebase will be set to true
for all tracking branches. See "branch.autoSetupMerge" for details
on how to set up a branch to track another branch. This option
defaults to never.
branch.<name>.remote
When on branch <name>, it tells _g_i_t _f_e_t_c_h and _g_i_t _p_u_s_h which remote
to fetch from/push to. The remote to push to may be overridden with
rreemmoottee..ppuusshhDDeeffaauulltt (for all branches). The remote to push to, for
the current branch, may be further overridden by
bbrraanncchh..<<nnaammee>>..ppuusshhRReemmoottee. If no remote is configured, or if you are
not on any branch, it defaults to oorriiggiinn for fetching and
rreemmoottee..ppuusshhDDeeffaauulltt for pushing. Additionally, .. (a period) is the
current local repository (a dot-repository), see
bbrraanncchh..<<nnaammee>>..mmeerrggee's final note below.
branch.<name>.pushRemote
When on branch <name>, it overrides bbrraanncchh..<<nnaammee>>..rreemmoottee for
pushing. It also overrides rreemmoottee..ppuusshhDDeeffaauulltt for pushing from
branch <name>. When you pull from one place (e.g. your upstream)
and push to another place (e.g. your own publishing repository),
you would want to set rreemmoottee..ppuusshhDDeeffaauulltt to specify the remote to
push to for all branches, and use this option to override it for a
specific branch.
branch.<name>.merge
Defines, together with branch.<name>.remote, the upstream branch
for the given branch. It tells _g_i_t _f_e_t_c_h/_g_i_t _p_u_l_l/_g_i_t _r_e_b_a_s_e which
branch to merge and can also affect _g_i_t _p_u_s_h (see push.default).
When in branch <name>, it tells _g_i_t _f_e_t_c_h the default refspec to be
marked for merging in FETCH_HEAD. The value is handled like the
remote part of a refspec, and must match a ref which is fetched
from the remote given by "branch.<name>.remote". The merge
information is used by _g_i_t _p_u_l_l (which at first calls _g_i_t _f_e_t_c_h) to
lookup the default branch for merging. Without this option, _g_i_t
_p_u_l_l defaults to merge the first refspec fetched. Specify multiple
values to get an octopus merge. If you wish to setup _g_i_t _p_u_l_l so
that it merges into <name> from another branch in the local
repository, you can point branch.<name>.merge to the desired
branch, and use the relative path setting .. (a period) for
branch.<name>.remote.
branch.<name>.mergeOptions
Sets default options for merging into branch <name>. The syntax and
supported options are the same as those of ggiitt--mmeerrggee(1), but option
values containing whitespace characters are currently not
supported.
branch.<name>.rebase
When true, rebase the branch <name> on top of the fetched branch,
instead of merging the default branch from the default remote when
"git pull" is run. See "pull.rebase" for doing this in a non
branch-specific manner.
When preserve, also pass ----pprreesseerrvvee--mmeerrggeess along to _g_i_t _r_e_b_a_s_e so
that locally committed merge commits will not be flattened by
running _g_i_t _p_u_l_l.
When the value is iinntteerraaccttiivvee, the rebase is run in interactive
mode.
NNOOTTEE: this is a possibly dangerous operation; do nnoott use it unless
you understand the implications (see ggiitt--rreebbaassee(1) for details).
branch.<name>.description
Branch description, can be edited with ggiitt bbrraanncchh
----eeddiitt--ddeessccrriippttiioonn. Branch description is automatically added in
the format-patch cover letter or request-pull summary.
browser.<tool>.cmd
Specify the command to invoke the specified browser. The specified
command is evaluated in shell with the URLs passed as arguments.
(See ggiitt--wweebb----bbrroowwssee(1).)
browser.<tool>.path
Override the path for the given tool that may be used to browse
HTML help (see --ww option in ggiitt--hheellpp(1)) or a working repository in
gitweb (see ggiitt--iinnssttaawweebb(1)).
clean.requireForce
A boolean to make git-clean do nothing unless given -f, -i or -n.
Defaults to true.
color.branch
A boolean to enable/disable color in the output of ggiitt--bbrraanncchh(1).
May be set to aallwwaayyss, ffaallssee (or nneevveerr) or aauuttoo (or ttrruuee), in which
case colors are used only when the output is to a terminal. If
unset, then the value of ccoolloorr..uuii is used (aauuttoo by default).
color.branch.<slot>
Use customized color for branch coloration. <<sslloott>> is one of
ccuurrrreenntt (the current branch), llooccaall (a local branch), rreemmoottee (a
remote-tracking branch in refs/remotes/), uuppssttrreeaamm (upstream
tracking branch), ppllaaiinn (other refs).
color.diff
Whether to use ANSI escape sequences to add color to patches. If
this is set to aallwwaayyss, ggiitt--ddiiffff(1), ggiitt--lloogg(1), and ggiitt--sshhooww(1)
will use color for all patches. If it is set to ttrruuee or aauuttoo, those
commands will only use color when output is to the terminal. If
unset, then the value of ccoolloorr..uuii is used (aauuttoo by default).
This does not affect ggiitt--ffoorrmmaatt--ppaattcchh(1) or the _g_i_t_-_d_i_f_f_-_* plumbing
commands. Can be overridden on the command line with the
----ccoolloorr[[==<<wwhheenn>>]] option.
color.diff.<slot>
Use customized color for diff colorization. <<sslloott>> specifies which
part of the patch to use the specified color, and is one of ccoonntteexxtt
(context text - ppllaaiinn is a historical synonym), mmeettaa
(metainformation), ffrraagg (hunk header), _f_u_n_c (function in hunk
header), oolldd (removed lines), nneeww (added lines), ccoommmmiitt (commit
headers), or wwhhiitteessppaaccee (highlighting whitespace errors).
color.decorate.<slot>
Use customized color for _g_i_t _l_o_g _-_-_d_e_c_o_r_a_t_e output. <<sslloott>> is one
of bbrraanncchh, rreemmootteeBBrraanncchh, ttaagg, ssttaasshh or HHEEAADD for local branches,
remote-tracking branches, tags, stash and HEAD, respectively.
color.grep
When set to aallwwaayyss, always highlight matches. When ffaallssee (or
nneevveerr), never. When set to ttrruuee or aauuttoo, use color only when the
output is written to the terminal. If unset, then the value of
ccoolloorr..uuii is used (aauuttoo by default).
color.grep.<slot>
Use customized color for grep colorization. <<sslloott>> specifies which
part of the line to use the specified color, and is one of
ccoonntteexxtt
non-matching text in context lines (when using --AA, --BB, or --CC)
ffiilleennaammee
filename prefix (when not using --hh)
ffuunnccttiioonn
function name lines (when using --pp)
lliinneennuummbbeerr
line number prefix (when using --nn)
mmaattcchh
matching text (same as setting mmaattcchhCCoonntteexxtt and mmaattcchhSSeelleecctteedd)
mmaattcchhCCoonntteexxtt
matching text in context lines
mmaattcchhSSeelleecctteedd
matching text in selected lines
sseelleecctteedd
non-matching text in selected lines
sseeppaarraattoorr
separators between fields on a line (::, --, and ==) and between
hunks (----)
color.interactive
When set to aallwwaayyss, always use colors for interactive prompts and
displays (such as those used by "git-add --interactive" and
"git-clean --interactive"). When false (or nneevveerr), never. When set
to ttrruuee or aauuttoo, use colors only when the output is to the
terminal. If unset, then the value of ccoolloorr..uuii is used (aauuttoo by
default).
color.interactive.<slot>
Use customized color for _g_i_t _a_d_d _-_-_i_n_t_e_r_a_c_t_i_v_e and _g_i_t _c_l_e_a_n
_-_-_i_n_t_e_r_a_c_t_i_v_e output. <<sslloott>> may be pprroommpptt, hheeaaddeerr, hheellpp or eerrrroorr,
for four distinct types of normal output from interactive commands.
color.pager
A boolean to enable/disable colored output when the pager is in use
(default is true).
color.showBranch
A boolean to enable/disable color in the output of ggiitt--sshhooww--
bbrraanncchh(1). May be set to aallwwaayyss, ffaallssee (or nneevveerr) or aauuttoo (or
ttrruuee), in which case colors are used only when the output is to a
terminal. If unset, then the value of ccoolloorr..uuii is used (aauuttoo by
default).
color.status
A boolean to enable/disable color in the output of ggiitt--ssttaattuuss(1).
May be set to aallwwaayyss, ffaallssee (or nneevveerr) or aauuttoo (or ttrruuee), in which
case colors are used only when the output is to a terminal. If
unset, then the value of ccoolloorr..uuii is used (aauuttoo by default).
color.status.<slot>
Use customized color for status colorization. <<sslloott>> is one of
hheeaaddeerr (the header text of the status message), aaddddeedd or uuppddaatteedd
(files which are added but not committed), cchhaannggeedd (files which are
changed but not added in the index), uunnttrraacckkeedd (files which are not
tracked by Git), bbrraanncchh (the current branch), nnoobbrraanncchh (the color
the _n_o _b_r_a_n_c_h warning is shown in, defaulting to red), or uunnmmeerrggeedd
(files which have unmerged changes).
color.ui
This variable determines the default value for variables such as
ccoolloorr..ddiiffff and ccoolloorr..ggrreepp that control the use of color per command
family. Its scope will expand as more commands learn configuration
to set a default for the ----ccoolloorr option. Set it to ffaallssee or nneevveerr
if you prefer Git commands not to use color unless enabled
explicitly with some other configuration or the ----ccoolloorr option. Set
it to aallwwaayyss if you want all output not intended for machine
consumption to use color, to ttrruuee or aauuttoo (this is the default
since Git 1.8.4) if you want such output to use color when written
to the terminal.
column.ui
Specify whether supported commands should output in columns. This
variable consists of a list of tokens separated by spaces or
commas:
These options control when the feature should be enabled (defaults
to _n_e_v_e_r):
aallwwaayyss
always show in columns
nneevveerr
never show in columns
aauuttoo
show in columns if the output is to the terminal
These options control layout (defaults to _c_o_l_u_m_n). Setting any of
these implies _a_l_w_a_y_s if none of _a_l_w_a_y_s, _n_e_v_e_r, or _a_u_t_o are
specified.
ccoolluummnn
fill columns before rows
rrooww
fill rows before columns
ppllaaiinn
show in one column
Finally, these options can be combined with a layout option
(defaults to _n_o_d_e_n_s_e):
ddeennssee
make unequal size columns to utilize more space
nnooddeennssee
make equal size columns
column.branch
Specify whether to output branch listing in ggiitt bbrraanncchh in columns.
See ccoolluummnn..uuii for details.
column.clean
Specify the layout when list items in ggiitt cclleeaann --ii, which always
shows files and directories in columns. See ccoolluummnn..uuii for details.
column.status
Specify whether to output untracked files in ggiitt ssttaattuuss in columns.
See ccoolluummnn..uuii for details.
column.tag
Specify whether to output tag listing in ggiitt ttaagg in columns. See
ccoolluummnn..uuii for details.
commit.cleanup
This setting overrides the default of the ----cclleeaannuupp option in ggiitt
ccoommmmiitt. See ggiitt--ccoommmmiitt(1) for details. Changing the default can be
useful when you always want to keep lines that begin with comment
character ## in your log message, in which case you would do ggiitt
ccoonnffiigg ccoommmmiitt..cclleeaannuupp wwhhiitteessppaaccee (note that you will have to remove
the help lines that begin with ## in the commit log template
yourself, if you do this).
commit.gpgSign
A boolean to specify whether all commits should be GPG signed. Use
of this option when doing operations such as rebase can result in a
large number of commits being signed. It may be convenient to use
an agent to avoid typing your GPG passphrase several times.
commit.status
A boolean to enable/disable inclusion of status information in the
commit message template when using an editor to prepare the commit
message. Defaults to true.
commit.template
Specify the pathname of a file to use as the template for new
commit messages.
commit.verbose
A boolean or int to specify the level of verbose with ggiitt ccoommmmiitt.
See ggiitt--ccoommmmiitt(1).
credential.helper
Specify an external helper to be called when a username or password
credential is needed; the helper may consult external storage to
avoid prompting the user for the credentials. Note that multiple
helpers may be defined. See ggiittccrreeddeennttiiaallss(7) for details.
credential.useHttpPath
When acquiring credentials, consider the "path" component of an
http or https URL to be important. Defaults to false. See
ggiittccrreeddeennttiiaallss(7) for more information.
credential.username
If no username is set for a network authentication, use this
username by default. See credential.<context>.* below, and
ggiittccrreeddeennttiiaallss(7).
credential.<url>.*
Any of the credential.* options above can be applied selectively to
some credentials. For example
"credential.https://example.com.username" would set the default
username only for https connections to example.com. See
ggiittccrreeddeennttiiaallss(7) for details on how URLs are matched.
credentialCache.ignoreSIGHUP
Tell git-credential-cache—daemon to ignore SIGHUP, instead of
quitting.
diff.autoRefreshIndex
When using _g_i_t _d_i_f_f to compare with work tree files, do not
consider stat-only change as changed. Instead, silently run ggiitt
uuppddaattee--iinnddeexx ----rreeffrreesshh to update the cached stat information for
paths whose contents in the work tree match the contents in the
index. This option defaults to true. Note that this affects only
_g_i_t _d_i_f_f Porcelain, and not lower level _d_i_f_f commands such as _g_i_t
_d_i_f_f_-_f_i_l_e_s.
diff.dirstat
A comma separated list of ----ddiirrssttaatt parameters specifying the
default behavior of the ----ddiirrssttaatt option to ggiitt--ddiiffff(1)` and
friends. The defaults can be overridden on the command line (using
----ddiirrssttaatt==<<ppaarraamm11,,ppaarraamm22,,......>>). The fallback defaults (when not
changed by ddiiffff..ddiirrssttaatt) are cchhaannggeess,,nnoonnccuummuullaattiivvee,,33. The following
parameters are available:
cchhaannggeess
Compute the dirstat numbers by counting the lines that have
been removed from the source, or added to the destination. This
ignores the amount of pure code movements within a file. In
other words, rearranging lines in a file is not counted as much
as other changes. This is the default behavior when no
parameter is given.
lliinneess
Compute the dirstat numbers by doing the regular line-based
diff analysis, and summing the removed/added line counts. (For
binary files, count 64-byte chunks instead, since binary files
have no natural concept of lines). This is a more expensive
----ddiirrssttaatt behavior than the cchhaannggeess behavior, but it does count
rearranged lines within a file as much as other changes. The
resulting output is consistent with what you get from the other
----**ssttaatt options.
ffiilleess
Compute the dirstat numbers by counting the number of files
changed. Each changed file counts equally in the dirstat
analysis. This is the computationally cheapest ----ddiirrssttaatt
behavior, since it does not have to look at the file contents
at all.
ccuummuullaattiivvee
Count changes in a child directory for the parent directory as
well. Note that when using ccuummuullaattiivvee, the sum of the
percentages reported may exceed 100%. The default
(non-cumulative) behavior can be specified with the
nnoonnccuummuullaattiivvee parameter.
<limit>
An integer parameter specifies a cut-off percent (3% by
default). Directories contributing less than this percentage of
the changes are not shown in the output.
Example: The following will count changed files, while ignoring
directories with less than 10% of the total amount of changed
files, and accumulating child directory counts in the parent
directories: ffiilleess,,1100,,ccuummuullaattiivvee.
diff.statGraphWidth
Limit the width of the graph part in --stat output. If set, applies
to all commands generating --stat output except format-patch.
diff.context
Generate diffs with <n> lines of context instead of the default of
3. This value is overridden by the -U option.
diff.interHunkContext
Show the context between diff hunks, up to the specified number of
lines, thereby fusing the hunks that are close to each other. This
value serves as the default for the ----iinntteerr--hhuunnkk--ccoonntteexxtt command
line option.
diff.external
If this config variable is set, diff generation is not performed
using the internal diff machinery, but using the given command. Can
be overridden with the ‘GIT_EXTERNAL_DIFF’ environment variable.
The command is called with parameters as described under "git
Diffs" in ggiitt(1). Note: if you want to use an external diff program
only on a subset of your files, you might want to use
ggiittaattttrriibbuutteess(5) instead.
diff.ignoreSubmodules
Sets the default value of --ignore-submodules. Note that this
affects only _g_i_t _d_i_f_f Porcelain, and not lower level _d_i_f_f commands
such as _g_i_t _d_i_f_f_-_f_i_l_e_s. _g_i_t _c_h_e_c_k_o_u_t also honors this setting when
reporting uncommitted changes. Setting it to _a_l_l disables the
submodule summary normally shown by _g_i_t _c_o_m_m_i_t and _g_i_t _s_t_a_t_u_s when
ssttaattuuss..ssuubbmmoodduulleeSSuummmmaarryy is set unless it is overridden by using the
--ignore-submodules command-line option. The _g_i_t _s_u_b_m_o_d_u_l_e commands
are not affected by this setting.
diff.mnemonicPrefix
If set, _g_i_t _d_i_f_f uses a prefix pair that is different from the
standard "a/" and "b/" depending on what is being compared. When
this configuration is in effect, reverse diff output also swaps the
order of the prefixes:
ggiitt ddiiffff
compares the (i)ndex and the (w)ork tree;
ggiitt ddiiffff HHEEAADD
compares a (c)ommit and the (w)ork tree;
ggiitt ddiiffff ----ccaacchheedd
compares a (c)ommit and the (i)ndex;
ggiitt ddiiffff HHEEAADD::ffiillee11 ffiillee22
compares an (o)bject and a (w)ork tree entity;
ggiitt ddiiffff ----nnoo--iinnddeexx aa bb
compares two non-git things (1) and (2).
diff.noprefix
If set, _g_i_t _d_i_f_f does not show any source or destination prefix.
diff.orderFile
File indicating how to order files within a diff. See the _-_O option
to ggiitt--ddiiffff(1) for details. If ddiiffff..oorrddeerrFFiillee is a relative
pathname, it is treated as relative to the top of the working tree.
diff.renameLimit
The number of files to consider when performing the copy/rename
detection; equivalent to the _g_i_t _d_i_f_f option --ll.
diff.renames
Whether and how Git detects renames. If set to "false", rename
detection is disabled. If set to "true", basic rename detection is
enabled. If set to "copies" or "copy", Git will detect copies, as
well. Defaults to true. Note that this affects only _g_i_t _d_i_f_f
Porcelain like ggiitt--ddiiffff(1) and ggiitt--lloogg(1), and not lower level
commands such as ggiitt--ddiiffff--ffiilleess(1).
diff.suppressBlankEmpty
A boolean to inhibit the standard behavior of printing a space
before each empty output line. Defaults to false.
diff.submodule
Specify the format in which differences in submodules are shown.
The "short" format just shows the names of the commits at the
beginning and end of the range. The "log" format lists the commits
in the range like ggiitt--ssuubbmmoodduullee(1)ssuummmmaarryy does. The "diff" format
shows an inline diff of the changed contents of the submodule.
Defaults to "short".
diff.wordRegex
A POSIX Extended Regular Expression used to determine what is a
"word" when performing word-by-word difference calculations.
Character sequences that match the regular expression are "words",
all other characters are iiggnnoorraabbllee whitespace.
diff.<driver>.command
The custom diff driver command. See ggiittaattttrriibbuutteess(5) for details.
diff.<driver>.xfuncname
The regular expression that the diff driver should use to recognize
the hunk header. A built-in pattern may also be used. See
ggiittaattttrriibbuutteess(5) for details.
diff.<driver>.binary
Set this option to true to make the diff driver treat files as
binary. See ggiittaattttrriibbuutteess(5) for details.
diff.<driver>.textconv
The command that the diff driver should call to generate the
text-converted version of a file. The result of the conversion is
used to generate a human-readable diff. See ggiittaattttrriibbuutteess(5) for
details.
diff.<driver>.wordRegex
The regular expression that the diff driver should use to split
words in a line. See ggiittaattttrriibbuutteess(5) for details.
diff.<driver>.cachetextconv
Set this option to true to make the diff driver cache the text
conversion outputs. See ggiittaattttrriibbuutteess(5) for details.
diff.tool
Controls which diff tool is used by ggiitt--ddiiffffttooooll(1). This variable
overrides the value configured in mmeerrggee..ttooooll. The list below shows
the valid built-in values. Any other value is treated as a custom
diff tool and requires that a corresponding difftool.<tool>.cmd
variable is defined.
· araxis
· bc
· bc3
· codecompare
· deltawalker
· diffmerge
· diffuse
· ecmerge
· emerge
· examdiff
· gvimdiff
· gvimdiff2
· gvimdiff3
· kdiff3
· kompare
· meld
· opendiff
· p4merge
· tkdiff
· vimdiff
· vimdiff2
· vimdiff3
· winmerge
· xxdiff
diff.indentHeuristic
Set this option to ttrruuee to enable experimental heuristics that
shift diff hunk boundaries to make patches easier to read.
diff.algorithm
Choose a diff algorithm. The variants are as follows:
ddeeffaauulltt, mmyyeerrss
The basic greedy diff algorithm. Currently, this is the
default.
mmiinniimmaall
Spend extra time to make sure the smallest possible diff is
produced.
ppaattiieennccee
Use "patience diff" algorithm when generating patches.
hhiissttooggrraamm
This algorithm extends the patience algorithm to "support
low-occurrence common elements".
diff.wsErrorHighlight
A comma separated list of oolldd, nneeww, ccoonntteexxtt, that specifies how
whitespace errors on lines are highlighted with
ccoolloorr..ddiiffff..wwhhiitteessppaaccee. Can be overridden by the command line option
----wwss--eerrrroorr--hhiigghhlliigghhtt==<<kkiinndd>>
difftool.<tool>.path
Override the path for the given tool. This is useful in case your
tool is not in the PATH.
difftool.<tool>.cmd
Specify the command to invoke the specified diff tool. The
specified command is evaluated in shell with the following
variables available: _L_O_C_A_L is set to the name of the temporary file
containing the contents of the diff pre-image and _R_E_M_O_T_E is set to
the name of the temporary file containing the contents of the diff
post-image.
difftool.prompt
Prompt before each invocation of the diff tool.
fastimport.unpackLimit
If the number of objects imported by ggiitt--ffaasstt--iimmppoorrtt(1) is below
this limit, then the objects will be unpacked into loose object
files. However if the number of imported objects equals or exceeds
this limit then the pack will be stored as a pack. Storing the pack
from a fast-import can make the import operation complete faster,
especially on slow filesystems. If not set, the value of
ttrraannssffeerr..uunnppaacckkLLiimmiitt is used instead.
fetch.recurseSubmodules
This option can be either set to a boolean value or to _o_n_-_d_e_m_a_n_d.
Setting it to a boolean changes the behavior of fetch and pull to
unconditionally recurse into submodules when set to true or to not
recurse at all when set to false. When set to _o_n_-_d_e_m_a_n_d (the
default value), fetch and pull will only recurse into a populated
submodule when its superproject retrieves a commit that updates the
submodule’s reference.
fetch.fsckObjects
If it is set to true, git-fetch-pack will check all fetched
objects. It will abort in the case of a malformed object or a
broken link. The result of an abort are only dangling objects.
Defaults to false. If not set, the value of ttrraannssffeerr..ffsscckkOObbjjeeccttss is
used instead.
fetch.unpackLimit
If the number of objects fetched over the Git native transfer is
below this limit, then the objects will be unpacked into loose
object files. However if the number of received objects equals or
exceeds this limit then the received pack will be stored as a pack,
after adding any missing delta bases. Storing the pack from a push
can make the push operation complete faster, especially on slow
filesystems. If not set, the value of ttrraannssffeerr..uunnppaacckkLLiimmiitt is used
instead.
fetch.prune
If true, fetch will automatically behave as if the ----pprruunnee option
was given on the command line. See also rreemmoottee..<<nnaammee>>..pprruunnee.
fetch.output
Control how ref update status is printed. Valid values are ffuullll and
ccoommppaacctt. Default value is ffuullll. See section OUTPUT in ggiitt--ffeettcchh(1)
for detail.
format.attach
Enable multipart/mixed attachments as the default for _f_o_r_m_a_t_-_p_a_t_c_h.
The value can also be a double quoted string which will enable
attachments as the default and set the value as the boundary. See
the --attach option in ggiitt--ffoorrmmaatt--ppaattcchh(1).
format.from
Provides the default value for the ----ffrroomm option to format-patch.
Accepts a boolean value, or a name and email address. If false,
format-patch defaults to ----nnoo--ffrroomm, using commit authors directly
in the "From:" field of patch mails. If true, format-patch defaults
to ----ffrroomm, using your committer identity in the "From:" field of
patch mails and including a "From:" field in the body of the patch
mail if different. If set to a non-boolean value, format-patch uses
that value instead of your committer identity. Defaults to false.
format.numbered
A boolean which can enable or disable sequence numbers in patch
subjects. It defaults to "auto" which enables it only if there is
more than one patch. It can be enabled or disabled for all messages
by setting it to "true" or "false". See --numbered option in ggiitt--
ffoorrmmaatt--ppaattcchh(1).
format.headers
Additional email headers to include in a patch to be submitted by
mail. See ggiitt--ffoorrmmaatt--ppaattcchh(1).
format.to, format.cc
Additional recipients to include in a patch to be submitted by
mail. See the --to and --cc options in ggiitt--ffoorrmmaatt--ppaattcchh(1).
format.subjectPrefix
The default for format-patch is to output files with the _[_P_A_T_C_H_]
subject prefix. Use this variable to change that prefix.
format.signature
The default for format-patch is to output a signature containing
the Git version number. Use this variable to change that default.
Set this variable to the empty string ("") to suppress signature
generation.
format.signatureFile
Works just like format.signature except the contents of the file
specified by this variable will be used as the signature.
format.suffix
The default for format-patch is to output files with the suffix
..ppaattcchh. Use this variable to change that suffix (make sure to
include the dot if you want it).
format.pretty
The default pretty format for log/show/whatchanged command, See
ggiitt--lloogg(1), ggiitt--sshhooww(1), ggiitt--wwhhaattcchhaannggeedd(1).
format.thread
The default threading style for _g_i_t _f_o_r_m_a_t_-_p_a_t_c_h. Can be a boolean
value, or sshhaallllooww or ddeeeepp. sshhaallllooww threading makes every mail a
reply to the head of the series, where the head is chosen from the
cover letter, the ----iinn--rreeppllyy--ttoo, and the first patch mail, in this
order. ddeeeepp threading makes every mail a reply to the previous
one. A true boolean value is the same as sshhaallllooww, and a false value
disables threading.
format.signOff
A boolean value which lets you enable the --ss//----ssiiggnnooffff option of
format-patch by default. NNoottee:: Adding the Signed-off-by: line to a
patch should be a conscious act and means that you certify you have
the rights to submit this work under the same open source license.
Please see the _S_u_b_m_i_t_t_i_n_g_P_a_t_c_h_e_s document for further discussion.
format.coverLetter
A boolean that controls whether to generate a cover-letter when
format-patch is invoked, but in addition can be set to "auto", to
generate a cover-letter only when there’s more than one patch.
format.outputDirectory
Set a custom directory to store the resulting files instead of the
current working directory.
format.useAutoBase
A boolean value which lets you enable the ----bbaassee==aauuttoo option of
format-patch by default.
filter.<driver>.clean
The command which is used to convert the content of a worktree file
to a blob upon checkin. See ggiittaattttrriibbuutteess(5) for details.
filter.<driver>.smudge
The command which is used to convert the content of a blob object
to a worktree file upon checkout. See ggiittaattttrriibbuutteess(5) for details.
fsck.<msg-id>
Allows overriding the message type (error, warn or ignore) of a
specific message ID such as mmiissssiinnggEEmmaaiill.
For convenience, fsck prefixes the error/warning with the message
ID, e.g. "missingEmail: invalid author/committer line - missing
email" means that setting ffsscckk..mmiissssiinnggEEmmaaiill == iiggnnoorree will hide that
issue.
This feature is intended to support working with legacy
repositories which cannot be repaired without disruptive changes.
fsck.skipList
The path to a sorted list of object names (i.e. one SHA-1 per line)
that are known to be broken in a non-fatal way and should be
ignored. This feature is useful when an established project should
be accepted despite early commits containing errors that can be
safely ignored such as invalid committer email addresses. Note:
corrupt objects cannot be skipped with this setting.
gc.aggressiveDepth
The depth parameter used in the delta compression algorithm used by
_g_i_t _g_c _-_-_a_g_g_r_e_s_s_i_v_e. This defaults to 50.
gc.aggressiveWindow
The window size parameter used in the delta compression algorithm
used by _g_i_t _g_c _-_-_a_g_g_r_e_s_s_i_v_e. This defaults to 250.
gc.auto
When there are approximately more than this many loose objects in
the repository, ggiitt ggcc ----aauuttoo will pack them. Some Porcelain
commands use this command to perform a light-weight garbage
collection from time to time. The default value is 6700. Setting
this to 0 disables it.
gc.autoPackLimit
When there are more than this many packs that are not marked with
**..kkeeeepp file in the repository, ggiitt ggcc ----aauuttoo consolidates them into
one larger pack. The default value is 50. Setting this to 0
disables it.
gc.autoDetach
Make ggiitt ggcc ----aauuttoo return immediately and run in background if the
system supports it. Default is true.
gc.logExpiry
If the file gc.log exists, then ggiitt ggcc ----aauuttoo won’t run unless that
file is more than _g_c_._l_o_g_E_x_p_i_r_y old. Default is "1.day". See
ggcc..pprruunneeEExxppiirree for more ways to specify its value.
gc.packRefs
Running ggiitt ppaacckk--rreeffss in a repository renders it unclonable by Git
versions prior to 1.5.1.2 over dumb transports such as HTTP. This
variable determines whether _g_i_t _g_c runs ggiitt ppaacckk--rreeffss. This can be
set to nnoottbbaarree to enable it within all non-bare repos or it can be
set to a boolean value. The default is ttrruuee.
gc.pruneExpire
When _g_i_t _g_c is run, it will call _p_r_u_n_e _-_-_e_x_p_i_r_e _2_._w_e_e_k_s_._a_g_o.
Override the grace period with this config variable. The value
"now" may be used to disable this grace period and always prune
unreachable objects immediately, or "never" may be used to suppress
pruning. This feature helps prevent corruption when _g_i_t _g_c runs
concurrently with another process writing to the repository; see
the "NOTES" section of ggiitt--ggcc(1).
gc.worktreePruneExpire
When _g_i_t _g_c is run, it calls _g_i_t _w_o_r_k_t_r_e_e _p_r_u_n_e _-_-_e_x_p_i_r_e
_3_._m_o_n_t_h_s_._a_g_o. This config variable can be used to set a different
grace period. The value "now" may be used to disable the grace
period and prune $$GGIITT__DDIIRR//wwoorrkkttrreeeess immediately, or "never" may be
used to suppress pruning.
gc.reflogExpire, gc.<pattern>.reflogExpire
_g_i_t _r_e_f_l_o_g _e_x_p_i_r_e removes reflog entries older than this time;
defaults to 90 days. The value "now" expires all entries
immediately, and "never" suppresses expiration altogether. With
"<pattern>" (e.g. "refs/stash") in the middle the setting applies
only to the refs that match the <pattern>.
gc.reflogExpireUnreachable, gc.<pattern>.reflogExpireUnreachable
_g_i_t _r_e_f_l_o_g _e_x_p_i_r_e removes reflog entries older than this time and
are not reachable from the current tip; defaults to 30 days. The
value "now" expires all entries immediately, and "never" suppresses
expiration altogether. With "<pattern>" (e.g. "refs/stash") in the
middle, the setting applies only to the refs that match the
<pattern>.
gc.rerereResolved
Records of conflicted merge you resolved earlier are kept for this
many days when _g_i_t _r_e_r_e_r_e _g_c is run. The default is 60 days. See
ggiitt--rreerreerree(1).
gc.rerereUnresolved
Records of conflicted merge you have not resolved are kept for this
many days when _g_i_t _r_e_r_e_r_e _g_c is run. The default is 15 days. See
ggiitt--rreerreerree(1).
gitcvs.commitMsgAnnotation
Append this string to each commit message. Set to empty string to
disable this feature. Defaults to "via git-CVS emulator".
gitcvs.enabled
Whether the CVS server interface is enabled for this repository.
See ggiitt--ccvvsssseerrvveerr(1).
gitcvs.logFile
Path to a log file where the CVS server interface well... logs
various stuff. See ggiitt--ccvvsssseerrvveerr(1).
gitcvs.usecrlfattr
If true, the server will look up the end-of-line conversion
attributes for files to determine the --kk modes to use. If the
attributes force Git to treat a file as text, the --kk mode will be
left blank so CVS clients will treat it as text. If they suppress
text conversion, the file will be set with _-_k_b mode, which
suppresses any newline munging the client might otherwise do. If
the attributes do not allow the file type to be determined, then
ggiittccvvss..aallllBBiinnaarryy is used. See ggiittaattttrriibbuutteess(5).
gitcvs.allBinary
This is used if ggiittccvvss..uusseeccrrllffaattttrr does not resolve the correct _-_k_b
mode to use. If true, all unresolved files are sent to the client
in mode _-_k_b. This causes the client to treat them as binary files,
which suppresses any newline munging it otherwise might do.
Alternatively, if it is set to "guess", then the contents of the
file are examined to decide if it is binary, similar to
ccoorree..aauuttooccrrllff.
gitcvs.dbName
Database used by git-cvsserver to cache revision information
derived from the Git repository. The exact meaning depends on the
used database driver, for SQLite (which is the default driver) this
is a filename. Supports variable substitution (see ggiitt--ccvvsssseerrvveerr(1)
for details). May not contain semicolons (;;). Default:
_%_G_g_i_t_c_v_s_._%_m_._s_q_l_i_t_e
gitcvs.dbDriver
Used Perl DBI driver. You can specify any available driver for this
here, but it might not work. git-cvsserver is tested with
_D_B_D_:_:_S_Q_L_i_t_e, reported to work with _D_B_D_:_:_P_g, and reported nnoott to
work with _D_B_D_:_:_m_y_s_q_l. Experimental feature. May not contain double
colons (::). Default: _S_Q_L_i_t_e. See ggiitt--ccvvsssseerrvveerr(1).
gitcvs.dbUser, gitcvs.dbPass
Database user and password. Only useful if setting ggiittccvvss..ddbbDDrriivveerr,
since SQLite has no concept of database users and/or passwords.
_g_i_t_c_v_s_._d_b_U_s_e_r supports variable substitution (see ggiitt--ccvvsssseerrvveerr(1)
for details).
gitcvs.dbTableNamePrefix
Database table name prefix. Prepended to the names of any database
tables used, allowing a single database to be used for several
repositories. Supports variable substitution (see ggiitt--ccvvsssseerrvveerr(1)
for details). Any non-alphabetic characters will be replaced with
underscores.
All gitcvs variables except for ggiittccvvss..uusseeccrrllffaattttrr and ggiittccvvss..aallllBBiinnaarryy
can also be specified as _g_i_t_c_v_s_._<_a_c_c_e_s_s___m_e_t_h_o_d_>_._<_v_a_r_n_a_m_e_> (where
_a_c_c_e_s_s___m_e_t_h_o_d is one of "ext" and "pserver") to make them apply only
for the given access method.
gitweb.category, gitweb.description, gitweb.owner, gitweb.url
See ggiittwweebb(1) for description.
gitweb.avatar, gitweb.blame, gitweb.grep, gitweb.highlight,
gitweb.patches, gitweb.pickaxe, gitweb.remote_heads, gitweb.showSizes,
gitweb.snapshot
See ggiittwweebb..ccoonnff(5) for description.
grep.lineNumber
If set to true, enable --nn option by default.
grep.patternType
Set the default matching behavior. Using a value of _b_a_s_i_c,
_e_x_t_e_n_d_e_d, _f_i_x_e_d, or _p_e_r_l will enable the ----bbaassiicc--rreeggeexxpp,
----eexxtteennddeedd--rreeggeexxpp, ----ffiixxeedd--ssttrriinnggss, or ----ppeerrll--rreeggeexxpp option
accordingly, while the value _d_e_f_a_u_l_t will return to the default
matching behavior.
grep.extendedRegexp
If set to true, enable ----eexxtteennddeedd--rreeggeexxpp option by default. This
option is ignored when the ggrreepp..ppaatttteerrnnTTyyppee option is set to a
value other than _d_e_f_a_u_l_t.
grep.threads
Number of grep worker threads to use. See ggrreepp..tthhrreeaaddss in ggiitt--
ggrreepp(1) for more information.
grep.fallbackToNoIndex
If set to true, fall back to git grep --no-index if git grep is
executed outside of a git repository. Defaults to false.
gpg.program
Use this custom program instead of "ggppgg" found on $$PPAATTHH when making
or verifying a PGP signature. The program must support the same
command-line interface as GPG, namely, to verify a detached
signature, "ggppgg ----vveerriiffyy $$ffiillee -- <<$$ssiiggnnaattuurree" is run, and the
program is expected to signal a good signature by exiting with code
0, and to generate an ASCII-armored detached signature, the
standard input of "ggppgg --bbssaauu $$kkeeyy" is fed with the contents to be
signed, and the program is expected to send the result to its
standard output.
gui.commitMsgWidth
Defines how wide the commit message window is in the ggiitt--gguuii(1).
"75" is the default.
gui.diffContext
Specifies how many context lines should be used in calls to diff
made by the ggiitt--gguuii(1). The default is "5".
gui.displayUntracked
Determines if ggiitt--gguuii(1) shows untracked files in the file list.
The default is "true".
gui.encoding
Specifies the default encoding to use for displaying of file
contents in ggiitt--gguuii(1) and ggiittkk(1). It can be overridden by setting
the _e_n_c_o_d_i_n_g attribute for relevant files (see ggiittaattttrriibbuutteess(5)).
If this option is not set, the tools default to the locale
encoding.
gui.matchTrackingBranch
Determines if new branches created with ggiitt--gguuii(1) should default
to tracking remote branches with matching names or not. Default:
"false".
gui.newBranchTemplate
Is used as suggested name when creating new branches using the ggiitt--
gguuii(1).
gui.pruneDuringFetch
"true" if ggiitt--gguuii(1) should prune remote-tracking branches when
performing a fetch. The default value is "false".
gui.trustmtime
Determines if ggiitt--gguuii(1) should trust the file modification
timestamp or not. By default the timestamps are not trusted.
gui.spellingDictionary
Specifies the dictionary used for spell checking commit messages in
the ggiitt--gguuii(1). When set to "none" spell checking is turned off.
gui.fastCopyBlame
If true, _g_i_t _g_u_i _b_l_a_m_e uses --CC instead of --CC --CC for original
location detection. It makes blame significantly faster on huge
repositories at the expense of less thorough copy detection.
gui.copyBlameThreshold
Specifies the threshold to use in _g_i_t _g_u_i _b_l_a_m_e original location
detection, measured in alphanumeric characters. See the ggiitt--
bbllaammee(1) manual for more information on copy detection.
gui.blamehistoryctx
Specifies the radius of history context in days to show in ggiittkk(1)
for the selected commit, when the SShhooww HHiissttoorryy CCoonntteexxtt menu item is
invoked from _g_i_t _g_u_i _b_l_a_m_e. If this variable is set to zero, the
whole history is shown.
guitool.<name>.cmd
Specifies the shell command line to execute when the corresponding
item of the ggiitt--gguuii(1)TToooollss menu is invoked. This option is
mandatory for every tool. The command is executed from the root of
the working directory, and in the environment it receives the name
of the tool as GGIITT__GGUUIITTOOOOLL, the name of the currently selected file
as _F_I_L_E_N_A_M_E, and the name of the current branch as _C_U_R___B_R_A_N_C_H (if
the head is detached, _C_U_R___B_R_A_N_C_H is empty).
guitool.<name>.needsFile
Run the tool only if a diff is selected in the GUI. It guarantees
that _F_I_L_E_N_A_M_E is not empty.
guitool.<name>.noConsole
Run the command silently, without creating a window to display its
output.
guitool.<name>.noRescan
Don’t rescan the working directory for changes after the tool
finishes execution.
guitool.<name>.confirm
Show a confirmation dialog before actually running the tool.
guitool.<name>.argPrompt
Request a string argument from the user, and pass it to the tool
through the AARRGGSS environment variable. Since requesting an argument
implies confirmation, the _c_o_n_f_i_r_m option has no effect if this is
enabled. If the option is set to _t_r_u_e, _y_e_s, or _1, the dialog uses a
built-in generic prompt; otherwise the exact value of the variable
is used.
guitool.<name>.revPrompt
Request a single valid revision from the user, and set the RREEVVIISSIIOONN
environment variable. In other aspects this option is similar to
_a_r_g_P_r_o_m_p_t, and can be used together with it.
guitool.<name>.revUnmerged
Show only unmerged branches in the _r_e_v_P_r_o_m_p_t subdialog. This is
useful for tools similar to merge or rebase, but not for things
like checkout or reset.
guitool.<name>.title
Specifies the title to use for the prompt dialog. The default is
the tool name.
guitool.<name>.prompt
Specifies the general prompt string to display at the top of the
dialog, before subsections for _a_r_g_P_r_o_m_p_t and _r_e_v_P_r_o_m_p_t. The default
value includes the actual command.
help.browser
Specify the browser that will be used to display help in the _w_e_b
format. See ggiitt--hheellpp(1).
help.format
Override the default help format used by ggiitt--hheellpp(1). Values _m_a_n,
_i_n_f_o, _w_e_b and _h_t_m_l are supported. _m_a_n is the default. _w_e_b and
_h_t_m_l are the same.
help.autoCorrect
Automatically correct and execute mistyped commands after waiting
for the given number of deciseconds (0.1 sec). If more than one
command can be deduced from the entered text, nothing will be
executed. If the value of this option is negative, the corrected
command will be executed immediately. If the value is 0 - the
command will be just shown but not executed. This is the default.
help.htmlPath
Specify the path where the HTML documentation resides. File system
paths and URLs are supported. HTML pages will be prefixed with this
path when help is displayed in the _w_e_b format. This defaults to the
documentation path of your Git installation.
http.proxy
Override the HTTP proxy, normally configured using the _h_t_t_p___p_r_o_x_y,
_h_t_t_p_s___p_r_o_x_y, and _a_l_l___p_r_o_x_y environment variables (see ccuurrll((11))). In
addition to the syntax understood by curl, it is possible to
specify a proxy string with a user name but no password, in which
case git will attempt to acquire one in the same way it does for
other credentials. See ggiittccrreeddeennttiiaallss(7) for more information. The
syntax thus is _[_p_r_o_t_o_c_o_l_:_/_/_]_[_u_s_e_r_[_:_p_a_s_s_w_o_r_d_]_@_]_p_r_o_x_y_h_o_s_t_[_:_p_o_r_t_].
This can be overridden on a per-remote basis; see
remote.<name>.proxy
http.proxyAuthMethod
Set the method with which to authenticate against the HTTP proxy.
This only takes effect if the configured proxy string contains a
user name part (i.e. is of the form _u_s_e_r_@_h_o_s_t or _u_s_e_r_@_h_o_s_t_:_p_o_r_t).
This can be overridden on a per-remote basis; see
rreemmoottee..<<nnaammee>>..pprrooxxyyAAuutthhMMeetthhoodd. Both can be overridden by the
GGIITT__HHTTTTPP__PPRROOXXYY__AAUUTTHHMMEETTHHOODD environment variable. Possible values
are:
· aannyyaauutthh - Automatically pick a suitable authentication method.
It is assumed that the proxy answers an unauthenticated request
with a 407 status code and one or more Proxy-authenticate
headers with supported authentication methods. This is the
default.
· bbaassiicc - HTTP Basic authentication
· ddiiggeesstt - HTTP Digest authentication; this prevents the password
from being transmitted to the proxy in clear text
· nneeggoottiiaattee - GSS-Negotiate authentication (compare the
--negotiate option of ccuurrll((11)))
· nnttllmm - NTLM authentication (compare the --ntlm option of
ccuurrll((11)))
http.emptyAuth
Attempt authentication without seeking a username or password. This
can be used to attempt GSS-Negotiate authentication without
specifying a username in the URL, as libcurl normally requires a
username for authentication.
http.delegation
Control GSSAPI credential delegation. The delegation is disabled by
default in libcurl since version 7.21.7. Set parameter to tell the
server what it is allowed to delegate when it comes to user
credentials. Used with GSS/kerberos. Possible values are:
· nnoonnee - Don’t allow any delegation.
· ppoolliiccyy - Delegates if and only if the OK-AS-DELEGATE flag is
set in the Kerberos service ticket, which is a matter of realm
policy.
· aallwwaayyss - Unconditionally allow the server to delegate.
http.extraHeader
Pass an additional HTTP header when communicating with a server. If
more than one such entry exists, all of them are added as extra
headers. To allow overriding the settings inherited from the system
config, an empty value will reset the extra headers to the empty
list.
http.cookieFile
The pathname of a file containing previously stored cookie lines,
which should be used in the Git http session, if they match the
server. The file format of the file to read cookies from should be
plain HTTP headers or the Netscape/Mozilla cookie file format (see
ccuurrll((11))). NOTE that the file specified with http.cookieFile is used
only as input unless http.saveCookies is set.
http.saveCookies
If set, store cookies received during requests to the file
specified by http.cookieFile. Has no effect if http.cookieFile is
unset.
http.sslVersion
The SSL version to use when negotiating an SSL connection, if you
want to force the default. The available and default version depend
on whether libcurl was built against NSS or OpenSSL and the
particular configuration of the crypto library in use. Internally
this sets the _C_U_R_L_O_P_T___S_S_L___V_E_R_S_I_O_N option; see the libcurl
documentation for more details on the format of this option and for
the ssl version supported. Actually the possible values of this
option are:
· sslv2
· sslv3
· tlsv1
· tlsv1.0
· tlsv1.1
· tlsv1.2
Can be overridden by the GGIITT__SSSSLL__VVEERRSSIIOONN environment variable. To
force git to use libcurl’s default ssl version and ignore any
explicit http.sslversion option, set GGIITT__SSSSLL__VVEERRSSIIOONN to the empty
string.
http.sslCipherList
A list of SSL ciphers to use when negotiating an SSL connection.
The available ciphers depend on whether libcurl was built against
NSS or OpenSSL and the particular configuration of the crypto
library in use. Internally this sets the _C_U_R_L_O_P_T___S_S_L___C_I_P_H_E_R___L_I_S_T
option; see the libcurl documentation for more details on the
format of this list.
Can be overridden by the GGIITT__SSSSLL__CCIIPPHHEERR__LLIISSTT environment variable.
To force git to use libcurl’s default cipher list and ignore any
explicit http.sslCipherList option, set GGIITT__SSSSLL__CCIIPPHHEERR__LLIISSTT to the
empty string.
http.sslVerify
Whether to verify the SSL certificate when fetching or pushing over
HTTPS. Can be overridden by the GGIITT__SSSSLL__NNOO__VVEERRIIFFYY environment
variable.
http.sslCert
File containing the SSL certificate when fetching or pushing over
HTTPS. Can be overridden by the GGIITT__SSSSLL__CCEERRTT environment variable.
http.sslKey
File containing the SSL private key when fetching or pushing over
HTTPS. Can be overridden by the GGIITT__SSSSLL__KKEEYY environment variable.
http.sslCertPasswordProtected
Enable Git’s password prompt for the SSL certificate. Otherwise
OpenSSL will prompt the user, possibly many times, if the
certificate or private key is encrypted. Can be overridden by the
GGIITT__SSSSLL__CCEERRTT__PPAASSSSWWOORRDD__PPRROOTTEECCTTEEDD environment variable.
http.sslCAInfo
File containing the certificates to verify the peer with when
fetching or pushing over HTTPS. Can be overridden by the
GGIITT__SSSSLL__CCAAIINNFFOO environment variable.
http.sslCAPath
Path containing files with the CA certificates to verify the peer
with when fetching or pushing over HTTPS. Can be overridden by the
GGIITT__SSSSLL__CCAAPPAATTHH environment variable.
http.pinnedpubkey
Public key of the https service. It may either be the filename of a
PEM or DER encoded public key file or a string starting with
_s_h_a_2_5_6_/_/ followed by the base64 encoded sha256 hash of the public
key. See also libcurl _C_U_R_L_O_P_T___P_I_N_N_E_D_P_U_B_L_I_C_K_E_Y. git will exit with
an error if this option is set but not supported by cURL.
http.sslTry
Attempt to use AUTH SSL/TLS and encrypted data transfers when
connecting via regular FTP protocol. This might be needed if the
FTP server requires it for security reasons or you wish to connect
securely whenever remote FTP server supports it. Default is false
since it might trigger certificate verification errors on
misconfigured servers.
http.maxRequests
How many HTTP requests to launch in parallel. Can be overridden by
the GGIITT__HHTTTTPP__MMAAXX__RREEQQUUEESSTTSS environment variable. Default is 5.
http.minSessions
The number of curl sessions (counted across slots) to be kept
across requests. They will not be ended with curl_easy_cleanup()
until http_cleanup() is invoked. If USE_CURL_MULTI is not defined,
this value will be capped at 1. Defaults to 1.
http.postBuffer
Maximum size in bytes of the buffer used by smart HTTP transports
when POSTing data to the remote system. For requests larger than
this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used
to avoid creating a massive pack file locally. Default is 1 MiB,
which is sufficient for most requests.
http.lowSpeedLimit, http.lowSpeedTime
If the HTTP transfer speed is less than _h_t_t_p_._l_o_w_S_p_e_e_d_L_i_m_i_t for
longer than _h_t_t_p_._l_o_w_S_p_e_e_d_T_i_m_e seconds, the transfer is aborted. Can
be overridden by the GGIITT__HHTTTTPP__LLOOWW__SSPPEEEEDD__LLIIMMIITT and
GGIITT__HHTTTTPP__LLOOWW__SSPPEEEEDD__TTIIMMEE environment variables.
http.noEPSV
A boolean which disables using of EPSV ftp command by curl. This
can helpful with some "poor" ftp servers which don’t support EPSV
mode. Can be overridden by the GGIITT__CCUURRLL__FFTTPP__NNOO__EEPPSSVV environment
variable. Default is false (curl will use EPSV).
http.userAgent
The HTTP USER_AGENT string presented to an HTTP server. The default
value represents the version of the client Git such as git/1.7.1.
This option allows you to override this value to a more common
value such as Mozilla/4.0. This may be necessary, for instance, if
connecting through a firewall that restricts HTTP connections to a
set of common USER_AGENT strings (but not including those like
git/1.7.1). Can be overridden by the GGIITT__HHTTTTPP__UUSSEERR__AAGGEENNTT
environment variable.
http.followRedirects
Whether git should follow HTTP redirects. If set to ttrruuee, git will
transparently follow any redirect issued by a server it encounters.
If set to ffaallssee, git will treat all redirects as errors. If set to
iinniittiiaall, git will follow redirects only for the initial request to
a remote, but not for subsequent follow-up HTTP requests. Since git
uses the redirected URL as the base for the follow-up requests,
this is generally sufficient. The default is iinniittiiaall.
http.<url>.*
Any of the http.* options above can be applied selectively to some
URLs. For a config key to match a URL, each element of the config
key is compared to that of the URL, in the following order:
1. Scheme (e.g., hhttttppss in hhttttppss::////eexxaammppllee..ccoomm//). This field must
match exactly between the config key and the URL.
2. Host/domain name (e.g., eexxaammppllee..ccoomm in hhttttppss::////eexxaammppllee..ccoomm//).
This field must match between the config key and the URL. It is
possible to specify a ** as part of the host name to match all
subdomains at this level. hhttttppss::////**..eexxaammppllee..ccoomm// for example
would match hhttttppss::////ffoooo..eexxaammppllee..ccoomm//, but not
hhttttppss::////ffoooo..bbaarr..eexxaammppllee..ccoomm//.
3. Port number (e.g., 88008800 in hhttttpp::////eexxaammppllee..ccoomm::88008800//). This
field must match exactly between the config key and the URL.
Omitted port numbers are automatically converted to the correct
default for the scheme before matching.
4. Path (e.g., rreeppoo..ggiitt in hhttttppss::////eexxaammppllee..ccoomm//rreeppoo..ggiitt). The path
field of the config key must match the path field of the URL
either exactly or as a prefix of slash-delimited path elements.
This means a config key with path ffoooo// matches URL path
ffoooo//bbaarr. A prefix can only match on a slash (//) boundary.
Longer matches take precedence (so a config key with path
ffoooo//bbaarr is a better match to URL path ffoooo//bbaarr than a config key
with just path ffoooo//).
5. User name (e.g., uusseerr in hhttttppss::////uusseerr@@eexxaammppllee..ccoomm//rreeppoo..ggiitt). If
the config key has a user name it must match the user name in
the URL exactly. If the config key does not have a user name,
that config key will match a URL with any user name (including
none), but at a lower precedence than a config key with a user
name.
The list above is ordered by decreasing precedence; a URL that
matches a config key’s path is preferred to one that matches its
user name. For example, if the URL is
hhttttppss::////uusseerr@@eexxaammppllee..ccoomm//ffoooo//bbaarr a config key match of
hhttttppss::////eexxaammppllee..ccoomm//ffoooo will be preferred over a config key match
of hhttttppss::////uusseerr@@eexxaammppllee..ccoomm.
All URLs are normalized before attempting any matching (the
password part, if embedded in the URL, is always ignored for
matching purposes) so that equivalent URLs that are simply spelled
differently will match properly. Environment variable settings
always override any matches. The URLs that are matched against are
those given directly to Git commands. This means any URLs visited
as a result of a redirection do not participate in matching.
ssh.variant
Depending on the value of the environment variables GGIITT__SSSSHH or
GGIITT__SSSSHH__CCOOMMMMAANNDD, or the config setting ccoorree..sssshhCCoommmmaanndd, Git
auto-detects whether to adjust its command-line parameters for use
with plink or tortoiseplink, as opposed to the default (OpenSSH).
The config variable sssshh..vvaarriiaanntt can be set to override this
auto-detection; valid values are sssshh, pplliinnkk, ppuuttttyy or
ttoorrttooiisseepplliinnkk. Any other value will be treated as normal ssh. This
setting can be overridden via the environment variable
GGIITT__SSSSHH__VVAARRIIAANNTT.
i18n.commitEncoding
Character encoding the commit messages are stored in; Git itself
does not care per se, but this information is necessary e.g. when
importing commits from emails or in the gitk graphical history
browser (and possibly at other places in the future or in other
porcelains). See e.g. ggiitt--mmaaiilliinnffoo(1). Defaults to _u_t_f_-_8.
i18n.logOutputEncoding
Character encoding the commit messages are converted to when
running _g_i_t _l_o_g and friends.
imap
The configuration variables in the _i_m_a_p section are described in
ggiitt--iimmaapp--sseenndd(1).
index.version
Specify the version with which new index files should be
initialized. This does not affect existing repositories.
init.templateDir
Specify the directory from which templates will be copied. (See the
"TEMPLATE DIRECTORY" section of ggiitt--iinniitt(1).)
instaweb.browser
Specify the program that will be used to browse your working
repository in gitweb. See ggiitt--iinnssttaawweebb(1).
instaweb.httpd
The HTTP daemon command-line to start gitweb on your working
repository. See ggiitt--iinnssttaawweebb(1).
instaweb.local
If true the web server started by ggiitt--iinnssttaawweebb(1) will be bound to
the local IP (127.0.0.1).
instaweb.modulePath
The default module path for ggiitt--iinnssttaawweebb(1) to use instead of
/usr/lib/apache2/modules. Only used if httpd is Apache.
instaweb.port
The port number to bind the gitweb httpd to. See ggiitt--iinnssttaawweebb(1).
interactive.singleKey
In interactive commands, allow the user to provide one-letter input
with a single key (i.e., without hitting enter). Currently this is
used by the ----ppaattcchh mode of ggiitt--aadddd(1), ggiitt--cchheecckkoouutt(1), ggiitt--
ccoommmmiitt(1), ggiitt--rreesseett(1), and ggiitt--ssttaasshh(1). Note that this setting
is silently ignored if portable keystroke input is not available;
requires the Perl module Term::ReadKey.
interactive.diffFilter
When an interactive command (such as ggiitt aadddd ----ppaattcchh) shows a
colorized diff, git will pipe the diff through the shell command
defined by this configuration variable. The command may mark up the
diff further for human consumption, provided that it retains a
one-to-one correspondence with the lines in the original diff.
Defaults to disabled (no filtering).
log.abbrevCommit
If true, makes ggiitt--lloogg(1), ggiitt--sshhooww(1), and ggiitt--wwhhaattcchhaannggeedd(1)
assume ----aabbbbrreevv--ccoommmmiitt. You may override this option with
----nnoo--aabbbbrreevv--ccoommmmiitt.
log.date
Set the default date-time mode for the _l_o_g command. Setting a value
for log.date is similar to using _g_i_t _l_o_g's ----ddaattee option. See ggiitt--
lloogg(1) for details.
log.decorate
Print out the ref names of any commits that are shown by the log
command. If _s_h_o_r_t is specified, the ref name prefixes _r_e_f_s_/_h_e_a_d_s_/,
_r_e_f_s_/_t_a_g_s_/ and _r_e_f_s_/_r_e_m_o_t_e_s_/ will not be printed. If _f_u_l_l is
specified, the full ref name (including prefix) will be printed. If
_a_u_t_o is specified, then if the output is going to a terminal, the
ref names are shown as if _s_h_o_r_t were given, otherwise no ref names
are shown. This is the same as the ----ddeeccoorraattee option of the ggiitt
lloogg.
log.follow
If ttrruuee, ggiitt lloogg will act as if the ----ffoollllooww option was used when a
single <path> is given. This has the same limitations as ----ffoollllooww,
i.e. it cannot be used to follow multiple files and does not work
well on non-linear history.
log.graphColors
A list of colors, separated by commas, that can be used to draw
history lines in ggiitt lloogg ----ggrraapphh.
log.showRoot
If true, the initial commit will be shown as a big creation event.
This is equivalent to a diff against an empty tree. Tools like ggiitt--
lloogg(1) or ggiitt--wwhhaattcchhaannggeedd(1), which normally hide the root commit
will now show it. True by default.
log.showSignature
If true, makes ggiitt--lloogg(1), ggiitt--sshhooww(1), and ggiitt--wwhhaattcchhaannggeedd(1)
assume ----sshhooww--ssiiggnnaattuurree.
log.mailmap
If true, makes ggiitt--lloogg(1), ggiitt--sshhooww(1), and ggiitt--wwhhaattcchhaannggeedd(1)
assume ----uussee--mmaaiillmmaapp.
mailinfo.scissors
If true, makes ggiitt--mmaaiilliinnffoo(1) (and therefore ggiitt--aamm(1)) act by
default as if the --scissors option was provided on the
command-line. When active, this features removes everything from
the message body before a scissors line (i.e. consisting mainly of
">8", "8<" and "-").
mailmap.file
The location of an augmenting mailmap file. The default mailmap,
located in the root of the repository, is loaded first, then the
mailmap file pointed to by this variable. The location of the
mailmap file may be in a repository subdirectory, or somewhere
outside of the repository itself. See ggiitt--sshhoorrttlloogg(1) and ggiitt--
bbllaammee(1).
mailmap.blob
Like mmaaiillmmaapp..ffiillee, but consider the value as a reference to a blob
in the repository. If both mmaaiillmmaapp..ffiillee and mmaaiillmmaapp..bblloobb are given,
both are parsed, with entries from mmaaiillmmaapp..ffiillee taking precedence.
In a bare repository, this defaults to HHEEAADD::..mmaaiillmmaapp. In a non-bare
repository, it defaults to empty.
man.viewer
Specify the programs that may be used to display help in the _m_a_n
format. See ggiitt--hheellpp(1).
man.<tool>.cmd
Specify the command to invoke the specified man viewer. The
specified command is evaluated in shell with the man page passed as
argument. (See ggiitt--hheellpp(1).)
man.<tool>.path
Override the path for the given tool that may be used to display
help in the _m_a_n format. See ggiitt--hheellpp(1).
merge.conflictStyle
Specify the style in which conflicted hunks are written out to
working tree files upon merge. The default is "merge", which shows
a <<<<<<<<<<<<<< conflict marker, changes made by one side, a ==============
marker, changes made by the other side, and then a >>>>>>>>>>>>>> marker.
An alternate style, "diff3", adds a |||||||||||||| marker and the original
text before the ============== marker.
merge.defaultToUpstream
If merge is called without any commit argument, merge the upstream
branches configured for the current branch by using their last
observed values stored in their remote-tracking branches. The
values of the bbrraanncchh..<<ccuurrrreenntt bbrraanncchh>>..mmeerrggee that name the branches
at the remote named by bbrraanncchh..<<ccuurrrreenntt bbrraanncchh>>..rreemmoottee are
consulted, and then they are mapped via rreemmoottee..<<rreemmoottee>>..ffeettcchh to
their corresponding remote-tracking branches, and the tips of these
tracking branches are merged.
merge.ff
By default, Git does not create an extra merge commit when merging
a commit that is a descendant of the current commit. Instead, the
tip of the current branch is fast-forwarded. When set to ffaallssee,
this variable tells Git to create an extra merge commit in such a
case (equivalent to giving the ----nnoo--ffff option from the command
line). When set to oonnllyy, only such fast-forward merges are allowed
(equivalent to giving the ----ffff--oonnllyy option from the command line).
merge.branchdesc
In addition to branch names, populate the log message with the
branch description text associated with them. Defaults to false.
merge.log
In addition to branch names, populate the log message with at most
the specified number of one-line descriptions from the actual
commits that are being merged. Defaults to false, and true is a
synonym for 20.
merge.renameLimit
The number of files to consider when performing rename detection
during a merge; if not specified, defaults to the value of
diff.renameLimit.
merge.renormalize
Tell Git that canonical representation of files in the repository
has changed over time (e.g. earlier commits record text files with
CRLF line endings, but recent ones use LF line endings). In such a
repository, Git can convert the data recorded in commits to a
canonical form before performing a merge to reduce unnecessary
conflicts. For more information, see section "Merging branches with
differing checkin/checkout attributes" in ggiittaattttrriibbuutteess(5).
merge.stat
Whether to print the diffstat between ORIG_HEAD and the merge
result at the end of the merge. True by default.
merge.tool
Controls which merge tool is used by ggiitt--mmeerrggeettooooll(1). The list
below shows the valid built-in values. Any other value is treated
as a custom merge tool and requires that a corresponding
mergetool.<tool>.cmd variable is defined.
· araxis
· bc
· bc3
· codecompare
· deltawalker
· diffmerge
· diffuse
· ecmerge
· emerge
· examdiff
· gvimdiff
· gvimdiff2
· gvimdiff3
· kdiff3
· meld
· opendiff
· p4merge
· tkdiff
· tortoisemerge
· vimdiff
· vimdiff2
· vimdiff3
· winmerge
· xxdiff
merge.verbosity
Controls the amount of output shown by the recursive merge
strategy. Level 0 outputs nothing except a final error message if
conflicts were detected. Level 1 outputs only conflicts, 2 outputs
conflicts and file changes. Level 5 and above outputs debugging
information. The default is level 2. Can be overridden by the
GGIITT__MMEERRGGEE__VVEERRBBOOSSIITTYY environment variable.
merge.<driver>.name
Defines a human-readable name for a custom low-level merge driver.
See ggiittaattttrriibbuutteess(5) for details.
merge.<driver>.driver
Defines the command that implements a custom low-level merge
driver. See ggiittaattttrriibbuutteess(5) for details.
merge.<driver>.recursive
Names a low-level merge driver to be used when performing an
internal merge between common ancestors. See ggiittaattttrriibbuutteess(5) for
details.
mergetool.<tool>.path
Override the path for the given tool. This is useful in case your
tool is not in the PATH.
mergetool.<tool>.cmd
Specify the command to invoke the specified merge tool. The
specified command is evaluated in shell with the following
variables available: _B_A_S_E is the name of a temporary file
containing the common base of the files to be merged, if available;
_L_O_C_A_L is the name of a temporary file containing the contents of
the file on the current branch; _R_E_M_O_T_E is the name of a temporary
file containing the contents of the file from the branch being
merged; _M_E_R_G_E_D contains the name of the file to which the merge
tool should write the results of a successful merge.
mergetool.<tool>.trustExitCode
For a custom merge command, specify whether the exit code of the
merge command can be used to determine whether the merge was
successful. If this is not set to true then the merge target file
timestamp is checked and the merge assumed to have been successful
if the file has been updated, otherwise the user is prompted to
indicate the success of the merge.
mergetool.meld.hasOutput
Older versions of mmeelldd do not support the ----oouuttppuutt option. Git will
attempt to detect whether mmeelldd supports ----oouuttppuutt by inspecting the
output of mmeelldd ----hheellpp. Configuring mmeerrggeettooooll..mmeelldd..hhaassOOuuttppuutt will
make Git skip these checks and use the configured value instead.
Setting mmeerrggeettooooll..mmeelldd..hhaassOOuuttppuutt to ttrruuee tells Git to
unconditionally use the ----oouuttppuutt option, and ffaallssee avoids using
----oouuttppuutt.
mergetool.keepBackup
After performing a merge, the original file with conflict markers
can be saved as a file with a ..oorriigg extension. If this variable is
set to ffaallssee then this file is not preserved. Defaults to ttrruuee
(i.e. keep the backup files).
mergetool.keepTemporaries
When invoking a custom merge tool, Git uses a set of temporary
files to pass to the tool. If the tool returns an error and this
variable is set to ttrruuee, then these temporary files will be
preserved, otherwise they will be removed after the tool has
exited. Defaults to ffaallssee.
mergetool.writeToTemp
Git writes temporary _B_A_S_E, _L_O_C_A_L, and _R_E_M_O_T_E versions of
conflicting files in the worktree by default. Git will attempt to
use a temporary directory for these files when set ttrruuee. Defaults
to ffaallssee.
mergetool.prompt
Prompt before each invocation of the merge resolution program.
notes.mergeStrategy
Which merge strategy to choose by default when resolving notes
conflicts. Must be one of mmaannuuaall, oouurrss, tthheeiirrss, uunniioonn, or
ccaatt__ssoorrtt__uunniiqq. Defaults to mmaannuuaall. See "NOTES MERGE STRATEGIES"
section of ggiitt--nnootteess(1) for more information on each strategy.
notes.<name>.mergeStrategy
Which merge strategy to choose when doing a notes merge into
refs/notes/<name>. This overrides the more general
"notes.mergeStrategy". See the "NOTES MERGE STRATEGIES" section in
ggiitt--nnootteess(1) for more information on the available strategies.
notes.displayRef
The (fully qualified) refname from which to show notes when showing
commit messages. The value of this variable can be set to a glob,
in which case notes from all matching refs will be shown. You may
also specify this configuration variable several times. A warning
will be issued for refs that do not exist, but a glob that does not
match any refs is silently ignored.
This setting can be overridden with the GGIITT__NNOOTTEESS__DDIISSPPLLAAYY__RREEFF
environment variable, which must be a colon separated list of refs
or globs.
The effective value of "core.notesRef" (possibly overridden by
GIT_NOTES_REF) is also implicitly added to the list of refs to be
displayed.
notes.rewrite.<command>
When rewriting commits with <command> (currently aammeenndd or rreebbaassee)
and this variable is set to ttrruuee, Git automatically copies your
notes from the original to the rewritten commit. Defaults to ttrruuee,
but see "notes.rewriteRef" below.
notes.rewriteMode
When copying notes during a rewrite (see the
"notes.rewrite.<command>" option), determines what to do if the
target commit already has a note. Must be one of oovveerrwwrriittee,
ccoonnccaatteennaattee, ccaatt__ssoorrtt__uunniiqq, or iiggnnoorree. Defaults to ccoonnccaatteennaattee.
This setting can be overridden with the GGIITT__NNOOTTEESS__RREEWWRRIITTEE__MMOODDEE
environment variable.
notes.rewriteRef
When copying notes during a rewrite, specifies the (fully
qualified) ref whose notes should be copied. The ref may be a glob,
in which case notes in all matching refs will be copied. You may
also specify this configuration several times.
Does not have a default value; you must configure this variable to
enable note rewriting. Set it to rreeffss//nnootteess//ccoommmmiittss to enable
rewriting for the default commit notes.
This setting can be overridden with the GGIITT__NNOOTTEESS__RREEWWRRIITTEE__RREEFF
environment variable, which must be a colon separated list of refs
or globs.
pack.window
The size of the window used by ggiitt--ppaacckk--oobbjjeeccttss(1) when no window
size is given on the command line. Defaults to 10.
pack.depth
The maximum delta depth used by ggiitt--ppaacckk--oobbjjeeccttss(1) when no maximum
depth is given on the command line. Defaults to 50.
pack.windowMemory
The maximum size of memory that is consumed by each thread in ggiitt--
ppaacckk--oobbjjeeccttss(1) for pack window memory when no limit is given on
the command line. The value can be suffixed with "k", "m", or "g".
When left unconfigured (or set explicitly to 0), there will be no
limit.
pack.compression
An integer -1..9, indicating the compression level for objects in a
pack file. -1 is the zlib default. 0 means no compression, and 1..9
are various speed/size tradeoffs, 9 being slowest. If not set,
defaults to core.compression. If that is not set, defaults to -1,
the zlib default, which is "a default compromise between speed and
compression (currently equivalent to level 6)."
Note that changing the compression level will not automatically
recompress all existing objects. You can force recompression by
passing the -F option to ggiitt--rreeppaacckk(1).
pack.deltaCacheSize
The maximum memory in bytes used for caching deltas in ggiitt--ppaacckk--
oobbjjeeccttss(1) before writing them out to a pack. This cache is used to
speed up the writing object phase by not having to recompute the
final delta result once the best match for all objects is found.
Repacking large repositories on machines which are tight with
memory might be badly impacted by this though, especially if this
cache pushes the system into swapping. A value of 0 means no limit.
The smallest size of 1 byte may be used to virtually disable this
cache. Defaults to 256 MiB.
pack.deltaCacheLimit
The maximum size of a delta, that is cached in ggiitt--ppaacckk--oobbjjeeccttss(1).
This cache is used to speed up the writing object phase by not
having to recompute the final delta result once the best match for
all objects is found. Defaults to 1000.
pack.threads
Specifies the number of threads to spawn when searching for best
delta matches. This requires that ggiitt--ppaacckk--oobbjjeeccttss(1) be compiled
with pthreads otherwise this option is ignored with a warning. This
is meant to reduce packing time on multiprocessor machines. The
required amount of memory for the delta search window is however
multiplied by the number of threads. Specifying 0 will cause Git to
auto-detect the number of CPU’s and set the number of threads
accordingly.
pack.indexVersion
Specify the default pack index version. Valid values are 1 for
legacy pack index used by Git versions prior to 1.5.2, and 2 for
the new pack index with capabilities for packs larger than 4 GB as
well as proper protection against the repacking of corrupted packs.
Version 2 is the default. Note that version 2 is enforced and this
config option ignored whenever the corresponding pack is larger
than 2 GB.
If you have an old Git that does not understand the version 2 **..iiddxx
file, cloning or fetching over a non native protocol (e.g. "http")
that will copy both **..ppaacckk file and corresponding **..iiddxx file from
the other side may give you a repository that cannot be accessed
with your older version of Git. If the **..ppaacckk file is smaller than
2 GB, however, you can use ggiitt--iinnddeexx--ppaacckk(1) on the *.pack file to
regenerate the **..iiddxx file.
pack.packSizeLimit
The maximum size of a pack. This setting only affects packing to a
file when repacking, i.e. the git:// protocol is unaffected. It can
be overridden by the ----mmaaxx--ppaacckk--ssiizzee option of ggiitt--rreeppaacckk(1).
Reaching this limit results in the creation of multiple packfiles;
which in turn prevents bitmaps from being created. The minimum size
allowed is limited to 1 MiB. The default is unlimited. Common unit
suffixes of _k, _m, or _g are supported.
pack.useBitmaps
When true, git will use pack bitmaps (if available) when packing to
stdout (e.g., during the server side of a fetch). Defaults to true.
You should not generally need to turn this off unless you are
debugging pack bitmaps.
pack.writeBitmaps (deprecated)
This is a deprecated synonym for rreeppaacckk..wwrriitteeBBiittmmaappss.
pack.writeBitmapHashCache
When true, git will include a "hash cache" section in the bitmap
index (if one is written). This cache can be used to feed git’s
delta heuristics, potentially leading to better deltas between
bitmapped and non-bitmapped objects (e.g., when serving a fetch
between an older, bitmapped pack and objects that have been pushed
since the last gc). The downside is that it consumes 4 bytes per
object of disk space, and that JGit’s bitmap implementation does
not understand it, causing it to complain if Git and JGit are used
on the same repository. Defaults to false.
pager.<cmd>
If the value is boolean, turns on or off pagination of the output
of a particular Git subcommand when writing to a tty. Otherwise,
turns on pagination for the subcommand using the pager specified by
the value of ppaaggeerr..<<ccmmdd>>. If ----ppaaggiinnaattee or ----nnoo--ppaaggeerr is specified
on the command line, it takes precedence over this option. To
disable pagination for all commands, set ccoorree..ppaaggeerr or GGIITT__PPAAGGEERR to
ccaatt.
pretty.<name>
Alias for a --pretty= format string, as specified in ggiitt--lloogg(1).
Any aliases defined here can be used just as the built-in pretty
formats could. For example, running ggiitt ccoonnffiigg pprreettttyy..cchhaannggeelloogg
""ffoorrmmaatt::** %%HH %%ss"" would cause the invocation ggiitt lloogg
----pprreettttyy==cchhaannggeelloogg to be equivalent to running ggiitt lloogg
""----pprreettttyy==ffoorrmmaatt::** %%HH %%ss"". Note that an alias with the same name as
a built-in format will be silently ignored.
protocol.allow
If set, provide a user defined default policy for all protocols
which don’t explicitly have a policy (pprroottooccooll..<<nnaammee>>..aallllooww). By
default, if unset, known-safe protocols (http, https, git, ssh,
file) have a default policy of aallwwaayyss, known-dangerous protocols
(ext) have a default policy of nneevveerr, and all other protocols have
a default policy of uusseerr. Supported policies:
· aallwwaayyss - protocol is always able to be used.
· nneevveerr - protocol is never able to be used.
· uusseerr - protocol is only able to be used when
GGIITT__PPRROOTTOOCCOOLL__FFRROOMM__UUSSEERR is either unset or has a value of 1.
This policy should be used when you want a protocol to be
directly usable by the user but don’t want it used by commands
which execute clone/fetch/push commands without user input,
e.g. recursive submodule initialization.
protocol.<name>.allow
Set a policy to be used by protocol <<nnaammee>> with clone/fetch/push
commands. See pprroottooccooll..aallllooww above for the available policies.
The protocol names currently used by git are:
· ffiillee: any local file-based path (including ffiillee:://// URLs, or
local paths)
· ggiitt: the anonymous git protocol over a direct TCP connection
(or proxy, if configured)
· sssshh: git over ssh (including hhoosstt::ppaatthh syntax, sssshh::////, etc).
· hhttttpp: git over http, both "smart http" and "dumb http". Note
that this does _n_o_t include hhttttppss; if you want to configure
both, you must do so individually.
· any external helpers are named by their protocol (e.g., use hhgg
to allow the ggiitt--rreemmoottee--hhgg helper)
pull.ff
By default, Git does not create an extra merge commit when merging
a commit that is a descendant of the current commit. Instead, the
tip of the current branch is fast-forwarded. When set to ffaallssee,
this variable tells Git to create an extra merge commit in such a
case (equivalent to giving the ----nnoo--ffff option from the command
line). When set to oonnllyy, only such fast-forward merges are allowed
(equivalent to giving the ----ffff--oonnllyy option from the command line).
This setting overrides mmeerrggee..ffff when pulling.
pull.rebase
When true, rebase branches on top of the fetched branch, instead of
merging the default branch from the default remote when "git pull"
is run. See "branch.<name>.rebase" for setting this on a per-branch
basis.
When preserve, also pass ----pprreesseerrvvee--mmeerrggeess along to _g_i_t _r_e_b_a_s_e so
that locally committed merge commits will not be flattened by
running _g_i_t _p_u_l_l.
When the value is iinntteerraaccttiivvee, the rebase is run in interactive
mode.
NNOOTTEE: this is a possibly dangerous operation; do nnoott use it unless
you understand the implications (see ggiitt--rreebbaassee(1) for details).
pull.octopus
The default merge strategy to use when pulling multiple branches at
once.
pull.twohead
The default merge strategy to use when pulling a single branch.
push.default
Defines the action ggiitt ppuusshh should take if no refspec is explicitly
given. Different values are well-suited for specific workflows; for
instance, in a purely central workflow (i.e. the fetch source is
equal to the push destination), uuppssttrreeaamm is probably what you want.
Possible values are:
· nnootthhiinngg - do not push anything (error out) unless a refspec is
explicitly given. This is primarily meant for people who want
to avoid mistakes by always being explicit.
· ccuurrrreenntt - push the current branch to update a branch with the
same name on the receiving end. Works in both central and
non-central workflows.
· uuppssttrreeaamm - push the current branch back to the branch whose
changes are usually integrated into the current branch (which
is called @@{{uuppssttrreeaamm}}). This mode only makes sense if you are
pushing to the same repository you would normally pull from
(i.e. central workflow).
· ttrraacckkiinngg - This is a deprecated synonym for uuppssttrreeaamm.
· ssiimmppllee - in centralized workflow, work like uuppssttrreeaamm with an
added safety to refuse to push if the upstream branch’s name is
different from the local one.
When pushing to a remote that is different from the remote you
normally pull from, work as ccuurrrreenntt. This is the safest option
and is suited for beginners.
This mode has become the default in Git 2.0.
· mmaattcchhiinngg - push all branches having the same name on both ends.
This makes the repository you are pushing to remember the set
of branches that will be pushed out (e.g. if you always push
_m_a_i_n_t and _m_a_s_t_e_r there and no other branches, the repository
you push to will have these two branches, and your local _m_a_i_n_t
and _m_a_s_t_e_r will be pushed there).
To use this mode effectively, you have to make sure _a_l_l the
branches you would push out are ready to be pushed out before
running _g_i_t _p_u_s_h, as the whole point of this mode is to allow
you to push all of the branches in one go. If you usually
finish work on only one branch and push out the result, while
other branches are unfinished, this mode is not for you. Also
this mode is not suitable for pushing into a shared central
repository, as other people may add new branches there, or
update the tip of existing branches outside your control.
This used to be the default, but not since Git 2.0 (ssiimmppllee is
the new default).
push.followTags
If set to true enable ----ffoollllooww--ttaaggss option by default. You may
override this configuration at time of push by specifying
----nnoo--ffoollllooww--ttaaggss.
push.gpgSign
May be set to a boolean value, or the string _i_f_-_a_s_k_e_d. A true value
causes all pushes to be GPG signed, as if ----ssiiggnneedd is passed to
ggiitt--ppuusshh(1). The string _i_f_-_a_s_k_e_d causes pushes to be signed if the
server supports it, as if ----ssiiggnneedd==iiff--aasskkeedd is passed to _g_i_t _p_u_s_h.
A false value may override a value from a lower-priority config
file. An explicit command-line flag always overrides this config
option.
push.recurseSubmodules
Make sure all submodule commits used by the revisions to be pushed
are available on a remote-tracking branch. If the value is _c_h_e_c_k
then Git will verify that all submodule commits that changed in the
revisions to be pushed are available on at least one remote of the
submodule. If any commits are missing, the push will be aborted and
exit with non-zero status. If the value is _o_n_-_d_e_m_a_n_d then all
submodules that changed in the revisions to be pushed will be
pushed. If on-demand was not able to push all necessary revisions
it will also be aborted and exit with non-zero status. If the value
is _n_o then default behavior of ignoring submodules when pushing is
retained. You may override this configuration at time of push by
specifying _-_-_r_e_c_u_r_s_e_-_s_u_b_m_o_d_u_l_e_s_=_c_h_e_c_k_|_o_n_-_d_e_m_a_n_d_|_n_o.
rebase.stat
Whether to show a diffstat of what changed upstream since the last
rebase. False by default.
rebase.autoSquash
If set to true enable ----aauuttoossqquuaasshh option by default.
rebase.autoStash
When set to true, automatically create a temporary stash before the
operation begins, and apply it after the operation ends. This means
that you can run rebase on a dirty worktree. However, use with
care: the final stash application after a successful rebase might
result in non-trivial conflicts. Defaults to false.
rebase.missingCommitsCheck
If set to "warn", git rebase -i will print a warning if some
commits are removed (e.g. a line was deleted), however the rebase
will still proceed. If set to "error", it will print the previous
warning and stop the rebase, _g_i_t _r_e_b_a_s_e _-_-_e_d_i_t_-_t_o_d_o can then be
used to correct the error. If set to "ignore", no checking is done.
To drop a commit without warning or error, use the ddrroopp command in
the todo-list. Defaults to "ignore".
rebase.instructionFormat
A format string, as specified in ggiitt--lloogg(1), to be used for the
instruction list during an interactive rebase. The format will
automatically have the long commit hash prepended to the format.
receive.advertiseAtomic
By default, git-receive-pack will advertise the atomic push
capability to its clients. If you don’t want to advertise this
capability, set this variable to false.
receive.advertisePushOptions
When set to true, git-receive-pack will advertise the push options
capability to its clients. False by default.
receive.autogc
By default, git-receive-pack will run "git-gc --auto" after
receiving data from git-push and updating refs. You can stop it by
setting this variable to false.
receive.certNonceSeed
By setting this variable to a string, ggiitt rreecceeiivvee--ppaacckk will accept
a ggiitt ppuusshh ----ssiiggnneedd and verifies it by using a "nonce" protected by
HMAC using this string as a secret key.
receive.certNonceSlop
When a ggiitt ppuusshh ----ssiiggnneedd sent a push certificate with a "nonce"
that was issued by a receive-pack serving the same repository
within this many seconds, export the "nonce" found in the
certificate to GGIITT__PPUUSSHH__CCEERRTT__NNOONNCCEE to the hooks (instead of what
the receive-pack asked the sending side to include). This may allow
writing checks in pprree--rreecceeiivvee and ppoosstt--rreecceeiivvee a bit easier.
Instead of checking GGIITT__PPUUSSHH__CCEERRTT__NNOONNCCEE__SSLLOOPP environment variable
that records by how many seconds the nonce is stale to decide if
they want to accept the certificate, they only can check
GGIITT__PPUUSSHH__CCEERRTT__NNOONNCCEE__SSTTAATTUUSS is OOKK.
receive.fsckObjects
If it is set to true, git-receive-pack will check all received
objects. It will abort in the case of a malformed object or a
broken link. The result of an abort are only dangling objects.
Defaults to false. If not set, the value of ttrraannssffeerr..ffsscckkOObbjjeeccttss is
used instead.
receive.fsck.<msg-id>
When rreecceeiivvee..ffsscckkOObbjjeeccttss is set to true, errors can be switched to
warnings and vice versa by configuring the rreecceeiivvee..ffsscckk..<<mmssgg--iidd>>
setting where the <<mmssgg--iidd>> is the fsck message ID and the value is
one of eerrrroorr, wwaarrnn or iiggnnoorree. For convenience, fsck prefixes the
error/warning with the message ID, e.g. "missingEmail: invalid
author/committer line - missing email" means that setting
rreecceeiivvee..ffsscckk..mmiissssiinnggEEmmaaiill == iiggnnoorree will hide that issue.
This feature is intended to support working with legacy
repositories which would not pass pushing when rreecceeiivvee..ffsscckkOObbjjeeccttss
== ttrruuee, allowing the host to accept repositories with certain known
issues but still catch other issues.
receive.fsck.skipList
The path to a sorted list of object names (i.e. one SHA-1 per line)
that are known to be broken in a non-fatal way and should be
ignored. This feature is useful when an established project should
be accepted despite early commits containing errors that can be
safely ignored such as invalid committer email addresses. Note:
corrupt objects cannot be skipped with this setting.
receive.keepAlive
After receiving the pack from the client, rreecceeiivvee--ppaacckk may produce
no output (if ----qquuiieett was specified) while processing the pack,
causing some networks to drop the TCP connection. With this option
set, if rreecceeiivvee--ppaacckk does not transmit any data in this phase for
rreecceeiivvee..kkeeeeppAAlliivvee seconds, it will send a short keepalive packet.
The default is 5 seconds; set to 0 to disable keepalives entirely.
receive.unpackLimit
If the number of objects received in a push is below this limit
then the objects will be unpacked into loose object files. However
if the number of received objects equals or exceeds this limit then
the received pack will be stored as a pack, after adding any
missing delta bases. Storing the pack from a push can make the push
operation complete faster, especially on slow filesystems. If not
set, the value of ttrraannssffeerr..uunnppaacckkLLiimmiitt is used instead.
receive.maxInputSize
If the size of the incoming pack stream is larger than this limit,
then git-receive-pack will error out, instead of accepting the pack
file. If not set or set to 0, then the size is unlimited.
receive.denyDeletes
If set to true, git-receive-pack will deny a ref update that
deletes the ref. Use this to prevent such a ref deletion via a
push.
receive.denyDeleteCurrent
If set to true, git-receive-pack will deny a ref update that
deletes the currently checked out branch of a non-bare repository.
receive.denyCurrentBranch
If set to true or "refuse", git-receive-pack will deny a ref update
to the currently checked out branch of a non-bare repository. Such
a push is potentially dangerous because it brings the HEAD out of
sync with the index and working tree. If set to "warn", print a
warning of such a push to stderr, but allow the push to proceed. If
set to false or "ignore", allow such pushes with no message.
Defaults to "refuse".
Another option is "updateInstead" which will update the working
tree if pushing into the current branch. This option is intended
for synchronizing working directories when one side is not easily
accessible via interactive ssh (e.g. a live web site, hence the
requirement that the working directory be clean). This mode also
comes in handy when developing inside a VM to test and fix code on
different Operating Systems.
By default, "updateInstead" will refuse the push if the working
tree or the index have any difference from the HEAD, but the
ppuusshh--ttoo--cchheecckkoouutt hook can be used to customize this. See
ggiitthhooookkss(5).
receive.denyNonFastForwards
If set to true, git-receive-pack will deny a ref update which is
not a fast-forward. Use this to prevent such an update via a push,
even if that push is forced. This configuration variable is set
when initializing a shared repository.
receive.hideRefs
This variable is the same as ttrraannssffeerr..hhiiddeeRReeffss, but applies only to
rreecceeiivvee--ppaacckk (and so affects pushes, but not fetches). An attempt
to update or delete a hidden ref by ggiitt ppuusshh is rejected.
receive.updateServerInfo
If set to true, git-receive-pack will run git-update-server-info
after receiving data from git-push and updating refs.
receive.shallowUpdate
If set to true, .git/shallow can be updated when new refs require
new shallow roots. Otherwise those refs are rejected.
remote.pushDefault
The remote to push to by default. Overrides bbrraanncchh..<<nnaammee>>..rreemmoottee
for all branches, and is overridden by bbrraanncchh..<<nnaammee>>..ppuusshhRReemmoottee for
specific branches.
remote.<name>.url
The URL of a remote repository. See ggiitt--ffeettcchh(1) or ggiitt--ppuusshh(1).
remote.<name>.pushurl
The push URL of a remote repository. See ggiitt--ppuusshh(1).
remote.<name>.proxy
For remotes that require curl (http, https and ftp), the URL to the
proxy to use for that remote. Set to the empty string to disable
proxying for that remote.
remote.<name>.proxyAuthMethod
For remotes that require curl (http, https and ftp), the method to
use for authenticating against the proxy in use (probably set in
rreemmoottee..<<nnaammee>>..pprrooxxyy). See hhttttpp..pprrooxxyyAAuutthhMMeetthhoodd.
remote.<name>.fetch
The default set of "refspec" for ggiitt--ffeettcchh(1). See ggiitt--ffeettcchh(1).
remote.<name>.push
The default set of "refspec" for ggiitt--ppuusshh(1). See ggiitt--ppuusshh(1).
remote.<name>.mirror
If true, pushing to this remote will automatically behave as if the
----mmiirrrroorr option was given on the command line.
remote.<name>.skipDefaultUpdate
If true, this remote will be skipped by default when updating using
ggiitt--ffeettcchh(1) or the uuppddaattee subcommand of ggiitt--rreemmoottee(1).
remote.<name>.skipFetchAll
If true, this remote will be skipped by default when updating using
ggiitt--ffeettcchh(1) or the uuppddaattee subcommand of ggiitt--rreemmoottee(1).
remote.<name>.receivepack
The default program to execute on the remote side when pushing. See
option --receive-pack of ggiitt--ppuusshh(1).
remote.<name>.uploadpack
The default program to execute on the remote side when fetching.
See option --upload-pack of ggiitt--ffeettcchh--ppaacckk(1).
remote.<name>.tagOpt
Setting this value to --no-tags disables automatic tag following
when fetching from remote <name>. Setting it to --tags will fetch
every tag from remote <name>, even if they are not reachable from
remote branch heads. Passing these flags directly to ggiitt--ffeettcchh(1)
can override this setting. See options --tags and --no-tags of ggiitt--
ffeettcchh(1).
remote.<name>.vcs
Setting this to a value <vcs> will cause Git to interact with the
remote with the git-remote-<vcs> helper.
remote.<name>.prune
When set to true, fetching from this remote by default will also
remove any remote-tracking references that no longer exist on the
remote (as if the ----pprruunnee option was given on the command line).
Overrides ffeettcchh..pprruunnee settings, if any.
remotes.<group>
The list of remotes which are fetched by "git remote update
<group>". See ggiitt--rreemmoottee(1).
repack.useDeltaBaseOffset
By default, ggiitt--rreeppaacckk(1) creates packs that use delta-base offset.
If you need to share your repository with Git older than version
1.4.4, either directly or via a dumb protocol such as http, then
you need to set this option to "false" and repack. Access from old
Git versions over the native protocol are unaffected by this
option.
repack.packKeptObjects
If set to true, makes ggiitt rreeppaacckk act as if ----ppaacckk--kkeepptt--oobbjjeeccttss was
passed. See ggiitt--rreeppaacckk(1) for details. Defaults to ffaallssee normally,
but ttrruuee if a bitmap index is being written (either via
----wwrriittee--bbiittmmaapp--iinnddeexx or rreeppaacckk..wwrriitteeBBiittmmaappss).
repack.writeBitmaps
When true, git will write a bitmap index when packing all objects
to disk (e.g., when ggiitt rreeppaacckk --aa is run). This index can speed up
the "counting objects" phase of subsequent packs created for clones
and fetches, at the cost of some disk space and extra time spent on
the initial repack. This has no effect if multiple packfiles are
created. Defaults to false.
rerere.autoUpdate
When set to true, ggiitt--rreerreerree updates the index with the resulting
contents after it cleanly resolves conflicts using previously
recorded resolution. Defaults to false.
rerere.enabled
Activate recording of resolved conflicts, so that identical
conflict hunks can be resolved automatically, should they be
encountered again. By default, ggiitt--rreerreerree(1) is enabled if there is
an rrrr--ccaacchhee directory under the $$GGIITT__DDIIRR, e.g. if "rerere" was
previously used in the repository.
sendemail.identity
A configuration identity. When given, causes values in the
_s_e_n_d_e_m_a_i_l_._<_i_d_e_n_t_i_t_y_> subsection to take precedence over values in
the _s_e_n_d_e_m_a_i_l section. The default identity is the value of
sseennddeemmaaiill..iiddeennttiittyy.
sendemail.smtpEncryption
See ggiitt--sseenndd--eemmaaiill(1) for description. Note that this setting is
not subject to the _i_d_e_n_t_i_t_y mechanism.
sendemail.smtpssl (deprecated)
Deprecated alias for _s_e_n_d_e_m_a_i_l_._s_m_t_p_E_n_c_r_y_p_t_i_o_n _= _s_s_l.
sendemail.smtpsslcertpath
Path to ca-certificates (either a directory or a single file). Set
it to an empty string to disable certificate verification.
sendemail.<identity>.*
Identity-specific versions of the _s_e_n_d_e_m_a_i_l_._* parameters found
below, taking precedence over those when the this identity is
selected, through command-line or sseennddeemmaaiill..iiddeennttiittyy.
sendemail.aliasesFile, sendemail.aliasFileType, sendemail.annotate,
sendemail.bcc, sendemail.cc, sendemail.ccCmd, sendemail.chainReplyTo,
sendemail.confirm, sendemail.envelopeSender, sendemail.from,
sendemail.multiEdit, sendemail.signedoffbycc, sendemail.smtpPass,
sendemail.suppresscc, sendemail.suppressFrom, sendemail.to,
sendemail.smtpDomain, sendemail.smtpServer, sendemail.smtpServerPort,
sendemail.smtpServerOption, sendemail.smtpUser, sendemail.thread,
sendemail.transferEncoding, sendemail.validate, sendemail.xmailer
See ggiitt--sseenndd--eemmaaiill(1) for description.
sendemail.signedoffcc (deprecated)
Deprecated alias for sseennddeemmaaiill..ssiiggnneeddooffffbbyycccc.
showbranch.default
The default set of branches for ggiitt--sshhooww--bbrraanncchh(1). See ggiitt--sshhooww--
bbrraanncchh(1).
splitIndex.maxPercentChange
When the split index feature is used, this specifies the percent of
entries the split index can contain compared to the total number of
entries in both the split index and the shared index before a new
shared index is written. The value should be between 0 and 100. If
the value is 0 then a new shared index is always written, if it is
100 a new shared index is never written. By default the value is
20, so a new shared index is written if the number of entries in
the split index would be greater than 20 percent of the total
number of entries. See ggiitt--uuppddaattee--iinnddeexx(1).
splitIndex.sharedIndexExpire
When the split index feature is used, shared index files that were
not modified since the time this variable specifies will be removed
when a new shared index file is created. The value "now" expires
all entries immediately, and "never" suppresses expiration
altogether. The default value is "2.weeks.ago". Note that a shared
index file is considered modified (for the purpose of expiration)
each time a new split-index file is either created based on it or
read from it. See ggiitt--uuppddaattee--iinnddeexx(1).
status.relativePaths
By default, ggiitt--ssttaattuuss(1) shows paths relative to the current
directory. Setting this variable to ffaallssee shows paths relative to
the repository root (this was the default for Git prior to v1.5.4).
status.short
Set to true to enable --short by default in ggiitt--ssttaattuuss(1). The
option --no-short takes precedence over this variable.
status.branch
Set to true to enable --branch by default in ggiitt--ssttaattuuss(1). The
option --no-branch takes precedence over this variable.
status.displayCommentPrefix
If set to true, ggiitt--ssttaattuuss(1) will insert a comment prefix before
each output line (starting with ccoorree..ccoommmmeennttCChhaarr, i.e. ## by
default). This was the behavior of ggiitt--ssttaattuuss(1) in Git 1.8.4 and
previous. Defaults to false.
status.showUntrackedFiles
By default, ggiitt--ssttaattuuss(1) and ggiitt--ccoommmmiitt(1) show files which are
not currently tracked by Git. Directories which contain only
untracked files, are shown with the directory name only. Showing
untracked files means that Git needs to lstat() all the files in
the whole repository, which might be slow on some systems. So, this
variable controls how the commands displays the untracked files.
Possible values are:
· nnoo - Show no untracked files.
· nnoorrmmaall - Show untracked files and directories.
· aallll - Show also individual files in untracked directories.
If this variable is not specified, it defaults to _n_o_r_m_a_l. This
variable can be overridden with the -u|--untracked-files option of
ggiitt--ssttaattuuss(1) and ggiitt--ccoommmmiitt(1).
status.submoduleSummary
Defaults to false. If this is set to a non zero number or true
(identical to -1 or an unlimited number), the submodule summary
will be enabled and a summary of commits for modified submodules
will be shown (see --summary-limit option of ggiitt--ssuubbmmoodduullee(1)).
Please note that the summary output command will be suppressed for
all submodules when ddiiffff..iiggnnoorreeSSuubbmmoodduulleess is set to _a_l_l or only for
those submodules where ssuubbmmoodduullee..<<nnaammee>>..iiggnnoorree==aallll. The only
exception to that rule is that status and commit will show staged
submodule changes. To also view the summary for ignored submodules
you can either use the --ignore-submodules=dirty command-line
option or the _g_i_t _s_u_b_m_o_d_u_l_e _s_u_m_m_a_r_y command, which shows a similar
output but does not honor these settings.
stash.showPatch
If this is set to true, the ggiitt ssttaasshh sshhooww command without an
option will show the stash in patch form. Defaults to false. See
description of _s_h_o_w command in ggiitt--ssttaasshh(1).
stash.showStat
If this is set to true, the ggiitt ssttaasshh sshhooww command without an
option will show diffstat of the stash. Defaults to true. See
description of _s_h_o_w command in ggiitt--ssttaasshh(1).
submodule.<name>.url
The URL for a submodule. This variable is copied from the
.gitmodules file to the git config via _g_i_t _s_u_b_m_o_d_u_l_e _i_n_i_t. The user
can change the configured URL before obtaining the submodule via
_g_i_t _s_u_b_m_o_d_u_l_e _u_p_d_a_t_e. If neither submodule.<name>.active or
submodule.active are set, the presence of this variable is used as
a fallback to indicate whether the submodule is of interest to git
commands. See ggiitt--ssuubbmmoodduullee(1) and ggiittmmoodduulleess(5) for details.
submodule.<name>.update
The default update procedure for a submodule. This variable is
populated by ggiitt ssuubbmmoodduullee iinniitt from the ggiittmmoodduulleess(5) file. See
description of _u_p_d_a_t_e command in ggiitt--ssuubbmmoodduullee(1).
submodule.<name>.branch
The remote branch name for a submodule, used by ggiitt ssuubbmmoodduullee
uuppddaattee ----rreemmoottee. Set this option to override the value found in the
..ggiittmmoodduulleess file. See ggiitt--ssuubbmmoodduullee(1) and ggiittmmoodduulleess(5) for
details.
submodule.<name>.fetchRecurseSubmodules
This option can be used to control recursive fetching of this
submodule. It can be overridden by using the
--[no-]recurse-submodules command-line option to "git fetch" and
"git pull". This setting will override that from in the
ggiittmmoodduulleess(5) file.
submodule.<name>.ignore
Defines under what circumstances "git status" and the diff family
show a submodule as modified. When set to "all", it will never be
considered modified (but it will nonetheless show up in the output
of status and commit when it has been staged), "dirty" will ignore
all changes to the submodules work tree and takes only differences
between the HEAD of the submodule and the commit recorded in the
superproject into account. "untracked" will additionally let
submodules with modified tracked files in their work tree show up.
Using "none" (the default when this option is not set) also shows
submodules that have untracked files in their work tree as changed.
This setting overrides any setting made in .gitmodules for this
submodule, both settings can be overridden on the command line by
using the "--ignore-submodules" option. The _g_i_t _s_u_b_m_o_d_u_l_e commands
are not affected by this setting.
submodule.<name>.active
Boolean value indicating if the submodule is of interest to git
commands. This config option takes precedence over the
submodule.active config option.
submodule.active
A repeated field which contains a pathspec used to match against a
submodule’s path to determine if the submodule is of interest to
git commands.
submodule.fetchJobs
Specifies how many submodules are fetched/cloned at the same time.
A positive integer allows up to that number of submodules fetched
in parallel. A value of 0 will give some reasonable default. If
unset, it defaults to 1.
submodule.alternateLocation
Specifies how the submodules obtain alternates when submodules are
cloned. Possible values are nnoo, ssuuppeerrpprroojjeecctt. By default nnoo is
assumed, which doesn’t add references. When the value is set to
ssuuppeerrpprroojjeecctt the submodule to be cloned computes its alternates
location relative to the superprojects alternate.
submodule.alternateErrorStrategy
Specifies how to treat errors with the alternates for a submodule
as computed via ssuubbmmoodduullee..aalltteerrnnaatteeLLooccaattiioonn. Possible values are
iiggnnoorree, iinnffoo, ddiiee. Default is ddiiee.
tag.forceSignAnnotated
A boolean to specify whether annotated tags created should be GPG
signed. If ----aannnnoottaattee is specified on the command line, it takes
precedence over this option.
tag.sort
This variable controls the sort ordering of tags when displayed by
ggiitt--ttaagg(1). Without the "--sort=<value>" option provided, the value
of this variable will be used as the default.
tar.umask
This variable can be used to restrict the permission bits of tar
archive entries. The default is 0002, which turns off the world
write bit. The special value "user" indicates that the archiving
user’s umask will be used instead. See umask(2) and ggiitt--aarrcchhiivvee(1).
transfer.fsckObjects
When ffeettcchh..ffsscckkOObbjjeeccttss or rreecceeiivvee..ffsscckkOObbjjeeccttss are not set, the
value of this variable is used instead. Defaults to false.
transfer.hideRefs
String(s) rreecceeiivvee--ppaacckk and uuppllooaadd--ppaacckk use to decide which refs to
omit from their initial advertisements. Use more than one
definition to specify multiple prefix strings. A ref that is under
the hierarchies listed in the value of this variable is excluded,
and is hidden when responding to ggiitt ppuusshh or ggiitt ffeettcchh. See
rreecceeiivvee..hhiiddeeRReeffss and uuppllooaaddppaacckk..hhiiddeeRReeffss for program-specific
versions of this config.
You may also include a !! in front of the ref name to negate the
entry, explicitly exposing it, even if an earlier entry marked it
as hidden. If you have multiple hideRefs values, later entries
override earlier ones (and entries in more-specific config files
override less-specific ones).
If a namespace is in use, the namespace prefix is stripped from
each reference before it is matched against ttrraannssffeerr..hhiiddeerreeffss
patterns. For example, if rreeffss//hheeaaddss//mmaasstteerr is specified in
ttrraannssffeerr..hhiiddeeRReeffss and the current namespace is ffoooo, then
rreeffss//nnaammeessppaacceess//ffoooo//rreeffss//hheeaaddss//mmaasstteerr is omitted from the
advertisements but rreeffss//hheeaaddss//mmaasstteerr and
rreeffss//nnaammeessppaacceess//bbaarr//rreeffss//hheeaaddss//mmaasstteerr are still advertised as
so-called "have" lines. In order to match refs before stripping,
add a ^^ in front of the ref name. If you combine !! and ^^, !! must
be specified first.
Even if you hide refs, a client may still be able to steal the
target objects via the techniques described in the "SECURITY"
section of the ggiittnnaammeessppaacceess(7) man page; it’s best to keep private
data in a separate repository.
transfer.unpackLimit
When ffeettcchh..uunnppaacckkLLiimmiitt or rreecceeiivvee..uunnppaacckkLLiimmiitt are not set, the
value of this variable is used instead. The default value is 100.
uploadarchive.allowUnreachable
If true, allow clients to use ggiitt aarrcchhiivvee ----rreemmoottee to request any
tree, whether reachable from the ref tips or not. See the
discussion in the "SECURITY" section of ggiitt--uuppllooaadd--aarrcchhiivvee(1) for
more details. Defaults to ffaallssee.
uploadpack.hideRefs
This variable is the same as ttrraannssffeerr..hhiiddeeRReeffss, but applies only to
uuppllooaadd--ppaacckk (and so affects only fetches, not pushes). An attempt
to fetch a hidden ref by ggiitt ffeettcchh will fail. See also
uuppllooaaddppaacckk..aalllloowwTTiippSSHHAA11IInnWWaanntt.
uploadpack.allowTipSHA1InWant
When uuppllooaaddppaacckk..hhiiddeeRReeffss is in effect, allow uuppllooaadd--ppaacckk to accept
a fetch request that asks for an object at the tip of a hidden ref
(by default, such a request is rejected). See also
uuppllooaaddppaacckk..hhiiddeeRReeffss. Even if this is false, a client may be able to
steal objects via the techniques described in the "SECURITY"
section of the ggiittnnaammeessppaacceess(7) man page; it’s best to keep private
data in a separate repository.
uploadpack.allowReachableSHA1InWant
Allow uuppllooaadd--ppaacckk to accept a fetch request that asks for an object
that is reachable from any ref tip. However, note that calculating
object reachability is computationally expensive. Defaults to
ffaallssee. Even if this is false, a client may be able to steal objects
via the techniques described in the "SECURITY" section of the
ggiittnnaammeessppaacceess(7) man page; it’s best to keep private data in a
separate repository.
uploadpack.allowAnySHA1InWant
Allow uuppllooaadd--ppaacckk to accept a fetch request that asks for any
object at all. Defaults to ffaallssee.
uploadpack.keepAlive
When uuppllooaadd--ppaacckk has started ppaacckk--oobbjjeeccttss, there may be a quiet
period while ppaacckk--oobbjjeeccttss prepares the pack. Normally it would
output progress information, but if ----qquuiieett was used for the fetch,
ppaacckk--oobbjjeeccttss will output nothing at all until the pack data begins.
Some clients and networks may consider the server to be hung and
give up. Setting this option instructs uuppllooaadd--ppaacckk to send an empty
keepalive packet every uuppllooaaddppaacckk..kkeeeeppAAlliivvee seconds. Setting this
option to 0 disables keepalive packets entirely. The default is 5
seconds.
uploadpack.packObjectsHook
If this option is set, when uuppllooaadd--ppaacckk would run ggiitt ppaacckk--oobbjjeeccttss
to create a packfile for a client, it will run this shell command
instead. The ppaacckk--oobbjjeeccttss command and arguments it _w_o_u_l_d have run
(including the ggiitt ppaacckk--oobbjjeeccttss at the beginning) are appended to
the shell command. The stdin and stdout of the hook are treated as
if ppaacckk--oobbjjeeccttss itself was run. I.e., uuppllooaadd--ppaacckk will feed input
intended for ppaacckk--oobbjjeeccttss to the hook, and expects a completed
packfile on stdout.
Note that this configuration variable is ignored if it is seen in
the repository-level config (this is a safety measure against
fetching from untrusted repositories).
url.<base>.insteadOf
Any URL that starts with this value will be rewritten to start,
instead, with <base>. In cases where some site serves a large
number of repositories, and serves them with multiple access
methods, and some users need to use different access methods, this
feature allows people to specify any of the equivalent URLs and
have Git automatically rewrite the URL to the best alternative for
the particular user, even for a never-before-seen repository on the
site. When more than one insteadOf strings match a given URL, the
longest match is used.
Note that any protocol restrictions will be applied to the
rewritten URL. If the rewrite changes the URL to use a custom
protocol or remote helper, you may need to adjust the
pprroottooccooll..**..aallllooww config to permit the request. In particular,
protocols you expect to use for submodules must be set to aallwwaayyss
rather than the default of uusseerr. See the description of
pprroottooccooll..aallllooww above.
url.<base>.pushInsteadOf
Any URL that starts with this value will not be pushed to; instead,
it will be rewritten to start with <base>, and the resulting URL
will be pushed to. In cases where some site serves a large number
of repositories, and serves them with multiple access methods, some
of which do not allow push, this feature allows people to specify a
pull-only URL and have Git automatically use an appropriate URL to
push, even for a never-before-seen repository on the site. When
more than one pushInsteadOf strings match a given URL, the longest
match is used. If a remote has an explicit pushurl, Git will ignore
this setting for that remote.
user.email
Your email address to be recorded in any newly created commits. Can
be overridden by the GGIITT__AAUUTTHHOORR__EEMMAAIILL, GGIITT__CCOOMMMMIITTTTEERR__EEMMAAIILL, and
EEMMAAIILL environment variables. See ggiitt--ccoommmmiitt--ttrreeee(1).
user.name
Your full name to be recorded in any newly created commits. Can be
overridden by the GGIITT__AAUUTTHHOORR__NNAAMMEE and GGIITT__CCOOMMMMIITTTTEERR__NNAAMMEE
environment variables. See ggiitt--ccoommmmiitt--ttrreeee(1).
user.useConfigOnly
Instruct Git to avoid trying to guess defaults for uusseerr..eemmaaiill and
uusseerr..nnaammee, and instead retrieve the values only from the
configuration. For example, if you have multiple email addresses
and would like to use a different one for each repository, then
with this configuration option set to ttrruuee in the global config
along with a name, Git will prompt you to set up an email before
making new commits in a newly cloned repository. Defaults to ffaallssee.
user.signingKey
If ggiitt--ttaagg(1) or ggiitt--ccoommmmiitt(1) is not selecting the key you want it
to automatically when creating a signed tag or commit, you can
override the default selection with this variable. This option is
passed unchanged to gpg’s --local-user parameter, so you may
specify a key using any method that gpg supports.
versionsort.prereleaseSuffix (deprecated)
Deprecated alias for vveerrssiioonnssoorrtt..ssuuffffiixx. Ignored if
vveerrssiioonnssoorrtt..ssuuffffiixx is set.
versionsort.suffix
Even when version sort is used in ggiitt--ttaagg(1), tagnames with the
same base version but different suffixes are still sorted
lexicographically, resulting e.g. in prerelease tags appearing
after the main release (e.g. "1.0-rc1" after "1.0"). This variable
can be specified to determine the sorting order of tags with
different suffixes.
By specifying a single suffix in this variable, any tagname
containing that suffix will appear before the corresponding main
release. E.g. if the variable is set to "-rc", then all "1.0-rcX"
tags will appear before "1.0". If specified multiple times, once
per suffix, then the order of suffixes in the configuration will
determine the sorting order of tagnames with those suffixes. E.g.
if "-pre" appears before "-rc" in the configuration, then all
"1.0-preX" tags will be listed before any "1.0-rcX" tags. The
placement of the main release tag relative to tags with various
suffixes can be determined by specifying the empty suffix among
those other suffixes. E.g. if the suffixes "-rc", "", "-ck" and
"-bfs" appear in the configuration in this order, then all
"v4.8-rcX" tags are listed first, followed by "v4.8", then
"v4.8-ckX" and finally "v4.8-bfsX".
If more than one suffixes match the same tagname, then that tagname
will be sorted according to the suffix which starts at the earliest
position in the tagname. If more than one different matching
suffixes start at that earliest position, then that tagname will be
sorted according to the longest of those suffixes. The sorting
order between different suffixes is undefined if they are in
multiple config files.
web.browser
Specify a web browser that may be used by some commands. Currently
only ggiitt--iinnssttaawweebb(1) and ggiitt--hheellpp(1) may use it.
GGIITT
Part of the ggiitt(1) suite
Git 2.13.6 09/24/2017 GIT-CONFIG(1)
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak your common history
branch List, create, or delete branches
checkout Switch branches or restore working tree files
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
Create a new object based on some data (e.g., file contents)
echo 'Hello World!' > f
git hash-object -t blob -w f
rm f
git-hash-object - Compute object ID and optionally creates a blob from a file
980a0d5f19a64b4b30a87d4206aade58726b60e3
Unique identifier for this data: each distinct file gets its own hash ("content-addressable storage")
echo -e 'blob 13\0Hello World!' | sha1sum
980a0d5f19a64b4b30a87d4206aade58726b60e3 -
git cat-file -t 980a0d5f19a64b4b30a87d4206aade58726b60e3 # object type
git cat-file -s 980a # any unique prefix of hash # object size
git cat-file -p 980a0d5 # contents
file1=980a0d5f19a64b4b30a87d4206aade58726b60e3 # save for later
git-cat-file - Provide content or type and size information for repository objects
blob
13
Hello World!
file2=$( echo 'Something completely different.' \
| git hash-object -t blob -w --stdin )
echo $file2
1a0985327d433bdfc3ea3c2b0a0443b3545064ac
git cat-file -p $file2
Something completely different.
find .git/objects -type f
.git/objects/98/0a0d5f19a64b4b30a87d4206aade58726b60e3 .git/objects/1a/0985327d433bdfc3ea3c2b0a0443b3545064ac
( echo -e 100644 blob $file1\\t"hello.txt" \
; echo -e 100644 blob $file2\\t"other.txt" \
) | git mktree
git-mktree - Build a tree-object from ls-tree formatted text
011ed906a8c5b0c0c14c0cad0a69d3969251b71f
tree0=011ed906a8c5b0c0c14c0cad0a69d3969251b71f
git cat-file -t $tree0
git cat-file -p $tree0
tree 100644 blob 980a0d5f19a64b4b30a87d4206aade58726b60e3 hello.txt 100644 blob 1a0985327d433bdfc3ea3c2b0a0443b3545064ac other.txt
( echo -e 040000 tree $tree0\\t"stuff" \
; echo -e 100644 blob $file1\\t"README" \
) | git mktree
c3595f6745f977f2450eeeb5bd94ccd2e4fba498
tree1=c3595f6745f977f2450eeeb5bd94ccd2e4fba498
git cat-file -p $tree1
100644 blob 980a0d5f19a64b4b30a87d4206aade58726b60e3 README 040000 tree 011ed906a8c5b0c0c14c0cad0a69d3969251b71f stuff
git ls-tree -tr $tree1
git-ls-tree - List the contents of a tree object
100644 blob 980a0d5f19a64b4b30a87d4206aade58726b60e3 README
040000 tree 011ed906a8c5b0c0c14c0cad0a69d3969251b71f stuff
100644 blob 980a0d5f19a64b4b30a87d4206aade58726b60e3 stuff/hello.txt
100644 blob 1a0985327d433bdfc3ea3c2b0a0443b3545064ac stuff/other.txt
Just as a blob is a snapshot of a file
file3=$( echo 'New and improved.' \
| git hash-object -t blob -w --stdin )
tree2=$( ( echo -e 100644 blob $file3\\t"README" \
; echo -e 040000 tree $tree0\\t"stuff" \
) | git mktree )
echo $tree2
git ls-tree -tr $tree2
674e727fabfeb840b5c4e36f2c33610dfb50458e 100644 blob f25e220dd7c5d3082f9754786f7fd6fcae6db473 README 040000 tree 011ed906a8c5b0c0c14c0cad0a69d3969251b71f stuff 100644 blob 980a0d5f19a64b4b30a87d4206aade58726b60e3 stuff/hello.txt 100644 blob 1a0985327d433bdfc3ea3c2b0a0443b3545064ac stuff/other.txt
Comparing snapshots is what git's for
git diff-tree -p $tree1 $tree2
git-diff-tree - Compares the content and mode of blobs found via two tree objects diff --git a/README b/README index 980a0d5..f25e220 100644 --- a/README +++ b/README @@ -1 +1 @@ -Hello World! +New and improved.
git archive $tree2 | tar tvf -
git-archive - Create an archive of files from a named tree
-rw-rw-r-- root/root 18 2017-10-17 11:02 README
drwxrwxr-x root/root 0 2017-10-17 11:02 stuff/
-rw-rw-r-- root/root 13 2017-10-17 11:02 stuff/hello.txt
-rw-rw-r-- root/root 32 2017-10-17 11:02 stuff/other.txt
A commit is a tree and some metadata
commit1=$( git commit-tree -m "Add some text files to my tree" $tree1 )
echo $commit1
git-commit-tree - Create a new commit object
2efdb20ab8b7d2e585ae0cd4209f9c4c525d94e1
git cat-file -p $commit1
tree c3595f6745f977f2450eeeb5bd94ccd2e4fba498 author Dylan Simon <dylan@dylex.net> 1497996000 -0400 committer Dylan Simon <dylan@dylex.net> 1497996000 -0400 Add some text files to my tree
A commit contains:
-m or in editor)git config --get 'user.name' # ~/.gitconfig
Dylan Simon
commit2=$( git commit-tree -p $commit1 -m "Improve README with new stuff" $tree2 )
echo $commit2
0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832
git cat-file -p $commit2
tree 674e727fabfeb840b5c4e36f2c33610dfb50458e parent 2efdb20ab8b7d2e585ae0cd4209f9c4c525d94e1 author Dylan Simon <dylan@dylex.net> 1498158000 -0400 committer Dylan Simon <dylan@dylex.net> 1498158000 -0400 Improve README with new stuff
By walking back through the chain of parents to the root, you can see the previous states (history) of the repository
Commits do not represent "diffs": they represent a snapshot state of the files
Commits can have multiple parents, in the case of merges (but usually only 2)
Commit objects form a DAG (directed, acyclic graph)
Graph arrows point backwards in time
COMMIT^: commit's (first) parentCOMMIT~N: Nth ancestorCOMMIT^{/TEXT}: most recent ancestor with TEXT in commit messageCOMMIT:PATH: tree or blob object for PATH within COMMITgit show "$commit2^{/text files}:stuff/hello.txt"
git-show - Show various types of objects
Hello World!
git log --graph $commit2
git-log - Show commit logs * commit 0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832 | Author: Dylan Simon <dylan@dylex.net> | Date: Thu Jun 22 15:00:00 2017 | | Improve README with new stuff | * commit 2efdb20ab8b7d2e585ae0cd4209f9c4c525d94e1 Author: Dylan Simon <dylan@dylex.net> Date: Tue Jun 20 18:00:00 2017 Add some text files to my tree
Many more to filter/search/reformat commit display
gitk (or github)
git diff $commit1 $commit2
git-diff - Show changes between commits, commit and working tree, etc diff --git a/README b/README index 980a0d5..f25e220 100644 --- a/README +++ b/README @@ -1 +1 @@ -Hello World! +New and improved.
Many other standard diff options (-a, -b, -U5, ...)
Git doesn't know anything about renames... but it can guess
Finally, something that can change
git update-ref refs/heads/master $commit1
git show-ref
git-update-ref - Update the object name stored in a ref safely git-show-ref - List references in a local repository 2efdb20ab8b7d2e585ae0cd4209f9c4c525d94e1 refs/heads/master
git update-ref refs/heads/master $commit2
cat .git/refs/heads/master
0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832
git show master
commit 0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832 (HEAD -> master) Author: Dylan Simon <dylan@dylex.net> Date: Thu Jun 22 15:00:00 2017 Improve README with new stuff diff --git a/README b/README index 980a0d5..f25e220 100644 --- a/README +++ b/README @@ -1 +1 @@ -Hello World! +New and improved.
git update-ref refs/heads/dylan/refactor master
git show-ref
0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832 refs/heads/dylan/refactor 0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832 refs/heads/master
git tag -m "Presented at SciCon 2017-06-27" scicon17 master
git show-ref
git-tag - Create, list, delete or verify a tag object signed with GPG
0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832 refs/heads/dylan/refactor
0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832 refs/heads/master
aa6742b68e7ea09070071d514e2030683f4ffd57 refs/tags/scicon17
git cat-file -p tags/scicon17
object 0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832 type commit tag scicon17 tagger Dylan Simon <dylan@dylex.net> 1498575600 -0400 Presented at SciCon 2017-06-27
Revision: any way to refer to a commit object (branch, tag, hash, ^, ...)
echo $commit2 | git pack-objects --revs pack
ls -l pack-*
git-pack-objects - Create a packed archive of objects
Counting objects: 8, done.
Delta compression using up to 24 threads.
Compressing objects: 100% (5/5), done.
9c5a911abad74b62a7fefb630c71f6b30859a9dc
Writing objects: 100% (8/8), done.
Total 8 (delta 0), reused 0 (delta 0)
-r--r--r-- 1 dylan dylan 1296 Oct 17 11:02 pack-9c5a911abad74b62a7fefb630c71f6b30859a9dc.idx
-r--r--r-- 1 dylan dylan 661 Oct 17 11:02 pack-9c5a911abad74b62a7fefb630c71f6b30859a9dc.pack
git repo: 1.3GB
"Don't worry about it."
git is designed for text files
Can handle any file in theory (github limit: 100MB), but poor for binary files
Moving files between git and your local working tree (disk)
git read-tree $tree1
file .git/index
git ls-files
git-read-tree - Reads tree information into the index .git/index: Git index, version 2, 3 entries git-ls-files - Show information about files in the index and the working tree README stuff/hello.txt stuff/other.txt
git checkout-index -a
ls -R
git-checkout-index - Copy files from the index to the working tree .: README stuff ./stuff: hello.txt other.txt
Staging changes to the index, from local changes made on disk
echo 'New and improved.' > README
git diff
diff --git a/README b/README index 980a0d5..f25e220 100644 --- a/README +++ b/README @@ -1 +1 @@ -Hello World! +New and improved.
git add README
git-add - Add file contents to the index
git write-tree
echo $tree2
git-write-tree - Create a tree object from the current index
674e727fabfeb840b5c4e36f2c33610dfb50458e
674e727fabfeb840b5c4e36f2c33610dfb50458e
git rm stuff/other.txt
git ls-files
git-rm - Remove files from the working tree and from the index
rm 'stuff/other.txt'
README
stuff/hello.txt
git mv README README.md
ls
git-mv - Move or rename a file, a directory, or a symlink README.md stuff
git rm [-r] [-f] FILE|DIRChecking out the index to overwrite local changes
echo 'maybe not...' >> README.md
git diff
diff --git a/README.md b/README.md index f25e220..63a9b90 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ New and improved. +maybe not...
git checkout -- README.md
git diff
git-checkout - Switch branches or restore working tree files
checkout does other things before the --
git symbolic-ref HEAD # show HEAD ref
cat .git/HEAD
git-symbolic-ref - Read, modify and delete symbolic refs
refs/heads/master
ref: refs/heads/master
git checkout dylan/refactor # also shows brief status of local
git symbolic-ref HEAD
git branch
D README A README.md D stuff/other.txt Switched to branch 'dylan/refactor' refs/heads/dylan/refactor git-branch - List, create, or delete branches * dylan/refactor master
git branch NEWBRANCH [REV]git checkout -b NEWBRANCH [REV]Adding commits to your current branch from the index
git commit -m "Mark down 'README'; no more other.txt"
git-commit - Record changes to the repository
[dylan/refactor e4212ad] Mark down 'README'; no more other.txt
2 files changed, 1 deletion(-)
rename README => README.md (100%)
delete mode 100644 stuff/other.txt
git branch -va
* dylan/refactor e4212ad Mark down 'README'; no more other.txt
master 0b5bcf3 Improve README with new stuff
git log --stat -2
commit e4212ad336cbaf2c4a5b454af07a484b1b09b83b (HEAD -> dylan/refactor) Author: Dylan Simon <dylan@dylex.net> Date: Fri Jun 30 13:00:00 2017 Mark down 'README'; no more other.txt README => README.md | 0 stuff/other.txt | 1 - 2 files changed, 1 deletion(-) commit 0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832 (tag: scicon17, master) Author: Dylan Simon <dylan@dylex.net> Date: Thu Jun 22 15:00:00 2017 Improve README with new stuff README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
git commit -m MSG1 [-m MSG2 ...]echo "New stuff" > stuff/more.txt
git add stuff/more.txt
echo "More to read" >> README.md
git status # HEAD vs. index and index vs. disk
git-status - Show the working tree status On branch dylan/refactor Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: stuff/more.txt Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: README.md
Dash-dash pattern: separates revisions from paths, can be omitted if unambiguous
git reset -- stuff/more.txt
Unstaged changes after reset: M README.md
| ↙ | disk | index | repo |
|---|---|---|---|
| disk | `checkout` | ||
| index | `add` | `reset` | |
| repo | `commit` | ||
Changing where the current branch points
`reset` counts as "rewriting history" (like `rebase`): don't do this on branches shared with others
git status
git branch -va
On branch dylan/refactor Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: README.md Untracked files: (use "git add <file>..." to include in what will be committed) stuff/more.txt no changes added to commit (use "git add" and/or "git commit -a") * dylan/refactor e4212ad Mark down 'README'; no more other.txt master 0b5bcf3 Improve README with new stuff
git checkout -m master
git status
M README Switched to branch 'master' On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: README Untracked files: (use "git add <file>..." to include in what will be committed) stuff/more.txt no changes added to commit (use "git add" and/or "git commit -a")
git diff
diff --git a/README b/README index f25e220..7074c76 100644 --- a/README +++ b/README @@ -1 +1,2 @@ New and improved. +More to read
git add .
git commit -m "Add more and more"
[master dc7e13a] Add more and more 2 files changed, 2 insertions(+) create mode 100644 stuff/more.txt
git show-branch
git-show-branch - Show branches and their commits ! [dylan/refactor] Mark down 'README'; no more other.txt * [master] Add more and more -- * [master] Add more and more + [dylan/refactor] Mark down 'README'; no more other.txt +* [master^] Improve README with new stuff
git merge dylan/refactor
git-merge - Join two or more development histories together Removing stuff/other.txt Merge made by the 'recursive' strategy. README => README.md | 0 stuff/other.txt | 1 - 2 files changed, 1 deletion(-) rename README => README.md (100%) delete mode 100644 stuff/other.txt
git log --graph -4
* commit f449e53c83fd0de9a94c36b271ce4a7c675ea92f (HEAD -> master) |\ Merge: dc7e13a e4212ad | | Author: Dylan Simon <dylan@dylex.net> | | Date: Fri Jun 30 14:00:00 2017 | | | | Merge branch 'dylan/refactor' | | | * commit e4212ad336cbaf2c4a5b454af07a484b1b09b83b (dylan/refactor) | | Author: Dylan Simon <dylan@dylex.net> | | Date: Fri Jun 30 13:00:00 2017 | | | | Mark down 'README'; no more other.txt | | * | commit dc7e13a6ad09aca550d5179dcce8f82bc44255a9 |/ Author: Dylan Simon <dylan@dylex.net> | Date: Fri Jun 30 14:00:00 2017 | | Add more and more | * commit 0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832 (tag: scicon17) | Author: Dylan Simon <dylan@dylex.net> | Date: Thu Jun 22 15:00:00 2017 | | Improve README with new stuff
If the two branches cannot be combined cleanly (conflicting changes)...
git add resultgit mergetool: interactively resolve conflicts based on both sets of changesgit revert e4212ad
git-revert - Revert some existing commits
[master 3fd3795] Revert "Mark down 'README'; no more other.txt"
2 files changed, 1 insertion(+)
rename README.md => README (100%)
create mode 100644 stuff/other.txt
git cherry-pick e4212ad
git-cherry-pick - Apply the changes introduced by some existing commits
[master 5482448] Mark down 'README'; no more other.txt
Date: Fri Jun 30 13:00:00 2017 -0400
2 files changed, 1 deletion(-)
rename README => README.md (100%)
delete mode 100644 stuff/other.txt
git log -2
commit 5482448f59a5f7ea2e488a9f1f077e5d0d3cfe37 (HEAD -> master) Author: Dylan Simon <dylan@dylex.net> Date: Fri Jun 30 13:00:00 2017 Mark down 'README'; no more other.txt commit 3fd3795a58b28d39b4ae8b0cec8f70e26c6eaaf4 Author: Dylan Simon <dylan@dylex.net> Date: Fri Jun 30 14:00:00 2017 Revert "Mark down 'README'; no more other.txt" This reverts commit e4212ad336cbaf2c4a5b454af07a484b1b09b83b.
touch output.txt
git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
output.txt
nothing added to commit but untracked files present (use "git add" to track)
git clean -f
git-clean - Remove untracked files from the working tree
Removing output.txt
echo "further reading" >> README.md
git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
git stash #push
git stash list
git-stash - Stash the changes in a dirty working directory away
Saved working directory and index state WIP on master: 5482448 Mark down 'README'; no more other.txt
stash@{0}: WIP on master: 5482448 Mark down 'README'; no more other.txt
git stash pop
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (2a4c13ea91689e4e2258ca24715088c9c52ef411)
git rebase [COMMIT]: attempt to linearize history (flatten merges) on top of COMMIT (upstream branch)git rebase -i [COMMIT]: use a text editor to reorder or combine commits since COMMITreset) unshared commits (or with agreement from everyone else)
git merge master, then git rebase master
cat README.md
git blame -- README.md
New and improved.
More to read
further reading
git-blame - Show what revision and author last modified each line of a file
0b5bcf36 README (Dylan Simon 2017-06-22 15:00:00 -0400 1) New and improved.
dc7e13a6 README (Dylan Simon 2017-06-30 14:00:00 -0400 2) More to read
00000000 README.md (Not Committed Yet 2017-10-17 11:02:20 -0400 3) further reading
git checkout -- README.md
Generated output, temporary files, etc.
echo '/output.*' > .gitignore
git add .gitignore
git commit -m 'Ignore all output files in top dir'
touch output.txt
git status
[master 7dfd4e5] Ignore all output files in top dir 1 file changed, 1 insertion(+) create mode 100644 .gitignore On branch master nothing to commit, working tree clean
Ignore patterns:
/*.out: only in this directory*.out: anywhere in this directory or below*.out/: only directories (not files)!this.out: cancel ignoreIgnore file lists:
.gitignore: in repository, for every instance of this repo~/.config/git/ignore: for you only, in all your git repos.git/info/include: for you only, in this repogit clean -fx
Removing output.txt
file path, sshable host ([user@]host:/path), or URL (git: or https:)
git remote add ghdylex git://github.com/dylex/git-structure-tutorial
git remote -v
git-remote - Manage set of tracked repositories
ghdylex git://github.com/dylex/git-structure-tutorial (fetch)
ghdylex git://github.com/dylex/git-structure-tutorial (push)
git fetch ghdylex # or: git remote update
git-fetch - Download objects and refs from another repository
remote: Counting objects: 150, done.
remote: Compressing objects: 100% (71/71), done.
remote: Total 150 (delta 68), reused 140 (delta 58), pack-reused 0
Receiving objects: 100% (150/150), 1.01 MiB | 14.30 MiB/s, done.
Resolving deltas: 100% (68/68), done.
From git://github.com/dylex/git-structure-tutorial
* [new branch] example -> ghdylex/example
* [new branch] gh-pages -> ghdylex/gh-pages
* [new branch] master -> ghdylex/master
fetch: download each remote refs/heads/BRANCH to refs/remotes/REMOTE/BRANCH tracking branch
git branch -va
dylan/refactor e4212ad Mark down 'README'; no more other.txt * master 7dfd4e5 Ignore all output files in top dir remotes/ghdylex/example f79c7b3 Add a period. remotes/ghdylex/gh-pages 2baf8b1 Update generated slides from 22e48c0 remotes/ghdylex/master 22e48c0 Add section on rebase
git merge ghdylex/example
Merge made by the 'recursive' strategy. README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ghdylex example
git-pull - Fetch from and integrate with another repository or a local branch
From git://github.com/dylex/git-structure-tutorial
* branch example -> FETCH_HEAD
Already up-to-date.
! git push ghdylex master
git-push - Update remote refs along with associated objects
fatal: remote error:
You can't push to git://github.com/dylex/git-structure-tutorial.git
Use https://github.com/dylex/git-structure-tutorial.git
git log --graph
* commit 7098d57271ab38aea12fa2381b85e91c29f98789 (HEAD -> master) |\ Merge: 7dfd4e5 f79c7b3 | | Author: Dylan Simon <dylan@dylex.net> | | Date: Fri Jun 30 14:00:00 2017 | | | | Merge remote-tracking branch 'ghdylex/example' | | | * commit f79c7b3fbb14f1664adeec9e5a6a36b023b5c171 (ghdylex/example) | | Author: Dylan Simon <dylan@dylex.net> | | Date: Mon Oct 16 14:13:31 2017 | | | | Add a period. | | * | commit 7dfd4e5f1c0d4aaf481326f5f3edbb008bcabf12 |/ Author: Dylan Simon <dylan@dylex.net> | Date: Fri Jun 30 14:00:00 2017 | | Ignore all output files in top dir | * commit 5482448f59a5f7ea2e488a9f1f077e5d0d3cfe37 | Author: Dylan Simon <dylan@dylex.net> | Date: Fri Jun 30 13:00:00 2017 | | Mark down 'README'; no more other.txt | * commit 3fd3795a58b28d39b4ae8b0cec8f70e26c6eaaf4 | Author: Dylan Simon <dylan@dylex.net> | Date: Fri Jun 30 14:00:00 2017 | | Revert "Mark down 'README'; no more other.txt" | | This reverts commit e4212ad336cbaf2c4a5b454af07a484b1b09b83b. | * commit f449e53c83fd0de9a94c36b271ce4a7c675ea92f |\ Merge: dc7e13a e4212ad | | Author: Dylan Simon <dylan@dylex.net> | | Date: Fri Jun 30 14:00:00 2017 | | | | Merge branch 'dylan/refactor' | | | * commit e4212ad336cbaf2c4a5b454af07a484b1b09b83b (dylan/refactor) | | Author: Dylan Simon <dylan@dylex.net> | | Date: Fri Jun 30 13:00:00 2017 | | | | Mark down 'README'; no more other.txt | | * | commit dc7e13a6ad09aca550d5179dcce8f82bc44255a9 |/ Author: Dylan Simon <dylan@dylex.net> | Date: Fri Jun 30 14:00:00 2017 | | Add more and more | * commit 0b5bcf36d47bf5abc4ec35c72e9a2c0294d8d832 (tag: scicon17) | Author: Dylan Simon <dylan@dylex.net> | Date: Thu Jun 22 15:00:00 2017 | | Improve README with new stuff | * commit 2efdb20ab8b7d2e585ae0cd4209f9c4c525d94e1 Author: Dylan Simon <dylan@dylex.net> Date: Tue Jun 20 18:00:00 2017 Add some text files to my tree
git clone git://github.com/dylex/git-structure-tutorial
git-clone - Clone a repository into a new directory
Cloning into 'git-structure-tutorial'...
remote: Counting objects: 171, done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 171 (delta 39), reused 76 (delta 31), pack-reused 85
Receiving objects: 100% (171/171), 1.16 MiB | 16.93 MiB/s, done.
Resolving deltas: 100% (67/67), done.
git -C git-structure-tutorial branch -va
* master 22e48c0 Add section on rebase remotes/origin/HEAD -> origin/master remotes/origin/example f79c7b3 Add a period. remotes/origin/gh-pages 2baf8b1 Update generated slides from 22e48c0 remotes/origin/master 22e48c0 Add section on rebase
clone is equivalent to:
git init DIR (default to repo basename, set with git clone URL DIR)git remote add origin URL (-o REMOTE sets name)git fetch REMOTEgit checkout master (-b BRANCH sets branch) or git checkout -b BRANCH -t REMOTE/BRANCHgit pullgit status, edit editgit commit -agit pushgh-pages branch published as user.github.io/repo)git help core-tutorial
GITCORE-TUTORIAL(7) Git Manual GITCORE-TUTORIAL(7)
NNAAMMEE
gitcore-tutorial - A Git core tutorial for developers
SSYYNNOOPPSSIISS
git *
DDEESSCCRRIIPPTTIIOONN
This tutorial explains how to use the "core" Git commands to set up and
work with a Git repository.
If you just need to use Git as a revision control system you may prefer
to start with "A Tutorial Introduction to Git" (ggiittttuuttoorriiaall(7)) or tthhee
GGiitt UUsseerr MMaannuuaall[1].
However, an understanding of these low-level tools can be helpful if
you want to understand Git’s internals.
The core Git is often called "plumbing", with the prettier user
interfaces on top of it called "porcelain". You may not want to use the
plumbing directly very often, but it can be good to know what the
plumbing does when the porcelain isn’t flushing.
Back when this document was originally written, many porcelain commands
were shell scripts. For simplicity, it still uses them as examples to
illustrate how plumbing is fit together to form the porcelain commands.
The source tree includes some of these scripts in contrib/examples/ for
reference. Although these are not implemented as shell scripts anymore,
the description of what the plumbing layer commands do is still valid.
NNoottee
Deeper technical details are often marked as Notes, which you can
skip on your first reading.
CCRREEAATTIINNGG AA GGIITT RREEPPOOSSIITTOORRYY
Creating a new Git repository couldn’t be easier: all Git repositories
start out empty, and the only thing you need to do is find yourself a
subdirectory that you want to use as a working tree - either an empty
one for a totally new project, or an existing working tree that you
want to import into Git.
For our first example, we’re going to start a totally new repository
from scratch, with no pre-existing files, and we’ll call it
_g_i_t_-_t_u_t_o_r_i_a_l. To start up, create a subdirectory for it, change into
that subdirectory, and initialize the Git infrastructure with _g_i_t _i_n_i_t:
$ mkdir git-tutorial
$ cd git-tutorial
$ git init
to which Git will reply
Initialized empty Git repository in .git/
which is just Git’s way of saying that you haven’t been doing anything
strange, and that it will have created a local ..ggiitt directory setup for
your new project. You will now have a ..ggiitt directory, and you can
inspect that with _l_s. For your new empty project, it should show you
three entries, among other things:
· a file called HHEEAADD, that has rreeff:: rreeffss//hheeaaddss//mmaasstteerr in it. This is
similar to a symbolic link and points at rreeffss//hheeaaddss//mmaasstteerr relative
to the HHEEAADD file.
Don’t worry about the fact that the file that the HHEEAADD link points
to doesn’t even exist yet — you haven’t created the commit that
will start your HHEEAADD development branch yet.
· a subdirectory called oobbjjeeccttss, which will contain all the objects
of your project. You should never have any real reason to look at
the objects directly, but you might want to know that these objects
are what contains all the real _d_a_t_a in your repository.
· a subdirectory called rreeffss, which contains references to objects.
In particular, the rreeffss subdirectory will contain two other
subdirectories, named hheeaaddss and ttaaggss respectively. They do exactly what
their names imply: they contain references to any number of different
_h_e_a_d_s of development (aka _b_r_a_n_c_h_e_s), and to any _t_a_g_s that you have
created to name specific versions in your repository.
One note: the special mmaasstteerr head is the default branch, which is why
the ..ggiitt//HHEEAADD file was created points to it even if it doesn’t yet
exist. Basically, the HHEEAADD link is supposed to always point to the
branch you are working on right now, and you always start out expecting
to work on the mmaasstteerr branch.
However, this is only a convention, and you can name your branches
anything you want, and don’t have to ever even _h_a_v_e a mmaasstteerr branch. A
number of the Git tools will assume that ..ggiitt//HHEEAADD is valid, though.
NNoottee
An _o_b_j_e_c_t is identified by its 160-bit SHA-1 hash, aka _o_b_j_e_c_t _n_a_m_e,
and a reference to an object is always the 40-byte hex
representation of that SHA-1 name. The files in the rreeffss
subdirectory are expected to contain these hex references (usually
with a final \\nn at the end), and you should thus expect to see a
number of 41-byte files containing these references in these rreeffss
subdirectories when you actually start populating your tree.
NNoottee
An advanced user may want to take a look at ggiittrreeppoossiittoorryy--llaayyoouutt(5)
after finishing this tutorial.
You have now created your first Git repository. Of course, since it’s
empty, that’s not very useful, so let’s start populating it with data.
PPOOPPUULLAATTIINNGG AA GGIITT RREEPPOOSSIITTOORRYY
We’ll keep this simple and stupid, so we’ll start off with populating a
few trivial files just to get a feel for it.
Start off with just creating any random files that you want to maintain
in your Git repository. We’ll start off with a few bad examples, just
to get a feel for how this works:
$ echo "Hello World" >hello
$ echo "Silly example" >example
you have now created two files in your working tree (aka _w_o_r_k_i_n_g
_d_i_r_e_c_t_o_r_y), but to actually check in your hard work, you will have to
go through two steps:
· fill in the _i_n_d_e_x file (aka _c_a_c_h_e) with the information about your
working tree state.
· commit that index file as an object.
The first step is trivial: when you want to tell Git about any changes
to your working tree, you use the _g_i_t _u_p_d_a_t_e_-_i_n_d_e_x program. That
program normally just takes a list of filenames you want to update, but
to avoid trivial mistakes, it refuses to add new entries to the index
(or remove existing ones) unless you explicitly tell it that you’re
adding a new entry with the ----aadddd flag (or removing an entry with the
----rreemmoovvee) flag.
So to populate the index with the two files you just created, you can
do
$ git update-index --add hello example
and you have now told Git to track those two files.
In fact, as you did that, if you now look into your object directory,
you’ll notice that Git will have added two new objects to the object
database. If you did exactly the steps above, you should now be able to
do
$ ls .git/objects/??/*
and see two files:
.git/objects/55/7db03de997c86a4a028e1ebd3a1ceb225be238
.git/objects/f2/4c74a2e500f5ee1332c86b94199f52b1d1d962
which correspond with the objects with names of 555577ddbb...... and ff2244cc77......
respectively.
If you want to, you can use _g_i_t _c_a_t_-_f_i_l_e to look at those objects, but
you’ll have to use the object name, not the filename of the object:
$ git cat-file -t 557db03de997c86a4a028e1ebd3a1ceb225be238
where the --tt tells _g_i_t _c_a_t_-_f_i_l_e to tell you what the "type" of the
object is. Git will tell you that you have a "blob" object (i.e., just
a regular file), and you can see the contents with
$ git cat-file blob 557db03
which will print out "Hello World". The object 555577ddbb0033 is nothing more
than the contents of your file hheelllloo.
NNoottee
Don’t confuse that object with the file hheelllloo itself. The object is
literally just those specific ccoonntteennttss of the file, and however
much you later change the contents in file hheelllloo, the object we
just looked at will never change. Objects are immutable.
NNoottee
The second example demonstrates that you can abbreviate the object
name to only the first several hexadecimal digits in most places.
Anyway, as we mentioned previously, you normally never actually take a
look at the objects themselves, and typing long 40-character hex names
is not something you’d normally want to do. The above digression was
just to show that _g_i_t _u_p_d_a_t_e_-_i_n_d_e_x did something magical, and actually
saved away the contents of your files into the Git object database.
Updating the index did something else too: it created a ..ggiitt//iinnddeexx
file. This is the index that describes your current working tree, and
something you should be very aware of. Again, you normally never worry
about the index file itself, but you should be aware of the fact that
you have not actually really "checked in" your files into Git so far,
you’ve only ttoolldd Git about them.
However, since Git knows about them, you can now start using some of
the most basic Git commands to manipulate the files or look at their
status.
In particular, let’s not even check in the two files into Git yet,
we’ll start off by adding another line to hheelllloo first:
$ echo "It's a new day for git" >>hello
and you can now, since you told Git about the previous state of hheelllloo,
ask Git what has changed in the tree compared to your old index, using
the _g_i_t _d_i_f_f_-_f_i_l_e_s command:
$ git diff-files
Oops. That wasn’t very readable. It just spit out its own internal
version of a _d_i_f_f, but that internal version really just tells you that
it has noticed that "hello" has been modified, and that the old object
contents it had have been replaced with something else.
To make it readable, we can tell _g_i_t _d_i_f_f_-_f_i_l_e_s to output the
differences as a patch, using the --pp flag:
$ git diff-files -p
diff --git a/hello b/hello
index 557db03..263414f 100644
--- a/hello
+++ b/hello
@@ -1 +1,2 @@
Hello World
+It's a new day for git
i.e. the diff of the change we caused by adding another line to hheelllloo.
In other words, _g_i_t _d_i_f_f_-_f_i_l_e_s always shows us the difference between
what is recorded in the index, and what is currently in the working
tree. That’s very useful.
A common shorthand for ggiitt ddiiffff--ffiilleess --pp is to just write ggiitt ddiiffff,
which will do the same thing.
$ git diff
diff --git a/hello b/hello
index 557db03..263414f 100644
--- a/hello
+++ b/hello
@@ -1 +1,2 @@
Hello World
+It's a new day for git
CCOOMMMMIITTTTIINNGG GGIITT SSTTAATTEE
Now, we want to go to the next stage in Git, which is to take the files
that Git knows about in the index, and commit them as a real tree. We
do that in two phases: creating a _t_r_e_e object, and committing that _t_r_e_e
object as a _c_o_m_m_i_t object together with an explanation of what the tree
was all about, along with information of how we came to that state.
Creating a tree object is trivial, and is done with _g_i_t _w_r_i_t_e_-_t_r_e_e.
There are no options or other input: ggiitt wwrriittee--ttrreeee will take the
current index state, and write an object that describes that whole
index. In other words, we’re now tying together all the different
filenames with their contents (and their permissions), and we’re
creating the equivalent of a Git "directory" object:
$ git write-tree
and this will just output the name of the resulting tree, in this case
(if you have done exactly as I’ve described) it should be
8988da15d077d4829fc51d8544c097def6644dbb
which is another incomprehensible object name. Again, if you want to,
you can use ggiitt ccaatt--ffiillee --tt 88998888dd...... to see that this time the object
is not a "blob" object, but a "tree" object (you can also use ggiitt
ccaatt--ffiillee to actually output the raw object contents, but you’ll see
mainly a binary mess, so that’s less interesting).
However — normally you’d never use _g_i_t _w_r_i_t_e_-_t_r_e_e on its own, because
normally you always commit a tree into a commit object using the _g_i_t
_c_o_m_m_i_t_-_t_r_e_e command. In fact, it’s easier to not actually use _g_i_t
_w_r_i_t_e_-_t_r_e_e on its own at all, but to just pass its result in as an
argument to _g_i_t _c_o_m_m_i_t_-_t_r_e_e.
_g_i_t _c_o_m_m_i_t_-_t_r_e_e normally takes several arguments — it wants to know
what the _p_a_r_e_n_t of a commit was, but since this is the first commit
ever in this new repository, and it has no parents, we only need to
pass in the object name of the tree. However, _g_i_t _c_o_m_m_i_t_-_t_r_e_e also
wants to get a commit message on its standard input, and it will write
out the resulting object name for the commit to its standard output.
And this is where we create the ..ggiitt//rreeffss//hheeaaddss//mmaasstteerr file which is
pointed at by HHEEAADD. This file is supposed to contain the reference to
the top-of-tree of the master branch, and since that’s exactly what _g_i_t
_c_o_m_m_i_t_-_t_r_e_e spits out, we can do this all with a sequence of simple
shell commands:
$ tree=$(git write-tree)
$ commit=$(echo 'Initial commit' | git commit-tree $tree)
$ git update-ref HEAD $commit
In this case this creates a totally new commit that is not related to
anything else. Normally you do this only oonnccee for a project ever, and
all later commits will be parented on top of an earlier commit.
Again, normally you’d never actually do this by hand. There is a
helpful script called ggiitt ccoommmmiitt that will do all of this for you. So
you could have just written ggiitt ccoommmmiitt instead, and it would have done
the above magic scripting for you.
MMAAKKIINNGG AA CCHHAANNGGEE
Remember how we did the _g_i_t _u_p_d_a_t_e_-_i_n_d_e_x on file hheelllloo and then we
changed hheelllloo afterward, and could compare the new state of hheelllloo with
the state we saved in the index file?
Further, remember how I said that _g_i_t _w_r_i_t_e_-_t_r_e_e writes the contents of
the iinnddeexx file to the tree, and thus what we just committed was in fact
the oorriiggiinnaall contents of the file hheelllloo, not the new ones. We did that
on purpose, to show the difference between the index state, and the
state in the working tree, and how they don’t have to match, even when
we commit things.
As before, if we do ggiitt ddiiffff--ffiilleess --pp in our git-tutorial project,
we’ll still see the same difference we saw last time: the index file
hasn’t changed by the act of committing anything. However, now that we
have committed something, we can also learn to use a new command: _g_i_t
_d_i_f_f_-_i_n_d_e_x.
Unlike _g_i_t _d_i_f_f_-_f_i_l_e_s, which showed the difference between the index
file and the working tree, _g_i_t _d_i_f_f_-_i_n_d_e_x shows the differences between
a committed ttrreeee and either the index file or the working tree. In
other words, _g_i_t _d_i_f_f_-_i_n_d_e_x wants a tree to be diffed against, and
before we did the commit, we couldn’t do that, because we didn’t have
anything to diff against.
But now we can do
$ git diff-index -p HEAD
(where --pp has the same meaning as it did in _g_i_t _d_i_f_f_-_f_i_l_e_s), and it
will show us the same difference, but for a totally different reason.
Now we’re comparing the working tree not against the index file, but
against the tree we just wrote. It just so happens that those two are
obviously the same, so we get the same result.
Again, because this is a common operation, you can also just shorthand
it with
$ git diff HEAD
which ends up doing the above for you.
In other words, _g_i_t _d_i_f_f_-_i_n_d_e_x normally compares a tree against the
working tree, but when given the ----ccaacchheedd flag, it is told to instead
compare against just the index cache contents, and ignore the current
working tree state entirely. Since we just wrote the index file to
HEAD, doing ggiitt ddiiffff--iinnddeexx ----ccaacchheedd --pp HHEEAADD should thus return an empty
set of differences, and that’s exactly what it does.
NNoottee
_g_i_t _d_i_f_f_-_i_n_d_e_x really always uses the index for its comparisons,
and saying that it compares a tree against the working tree is thus
not strictly accurate. In particular, the list of files to compare
(the "meta-data") aallwwaayyss comes from the index file, regardless of
whether the ----ccaacchheedd flag is used or not. The ----ccaacchheedd flag really
only determines whether the file ccoonntteennttss to be compared come from
the working tree or not.
This is not hard to understand, as soon as you realize that Git
simply never knows (or cares) about files that it is not told about
explicitly. Git will never go llooookkiinngg for files to compare, it
expects you to tell it what the files are, and that’s what the
index is there for.
However, our next step is to commit the cchhaannggee we did, and again, to
understand what’s going on, keep in mind the difference between
"working tree contents", "index file" and "committed tree". We have
changes in the working tree that we want to commit, and we always have
to work through the index file, so the first thing we need to do is to
update the index cache:
$ git update-index hello
(note how we didn’t need the ----aadddd flag this time, since Git knew about
the file already).
Note what happens to the different _g_i_t _d_i_f_f_-_* versions here. After
we’ve updated hheelllloo in the index, ggiitt ddiiffff--ffiilleess --pp now shows no
differences, but ggiitt ddiiffff--iinnddeexx --pp HHEEAADD still ddooeess show that the
current state is different from the state we committed. In fact, now
_g_i_t _d_i_f_f_-_i_n_d_e_x shows the same difference whether we use the ----ccaacchheedd
flag or not, since now the index is coherent with the working tree.
Now, since we’ve updated hheelllloo in the index, we can commit the new
version. We could do it by writing the tree by hand again, and
committing the tree (this time we’d have to use the --pp HHEEAADD flag to
tell commit that the HEAD was the ppaarreenntt of the new commit, and that
this wasn’t an initial commit any more), but you’ve done that once
already, so let’s just use the helpful script this time:
$ git commit
which starts an editor for you to write the commit message and tells
you a bit about what you have done.
Write whatever message you want, and all the lines that start with _#
will be pruned out, and the rest will be used as the commit message for
the change. If you decide you don’t want to commit anything after all
at this point (you can continue to edit things and update the index),
you can just leave an empty message. Otherwise ggiitt ccoommmmiitt will commit
the change for you.
You’ve now made your first real Git commit. And if you’re interested in
looking at what ggiitt ccoommmmiitt really does, feel free to investigate: it’s
a few very simple shell scripts to generate the helpful (?) commit
message headers, and a few one-liners that actually do the commit
itself (_g_i_t _c_o_m_m_i_t).
IINNSSPPEECCTTIINNGG CCHHAANNGGEESS
While creating changes is useful, it’s even more useful if you can tell
later what changed. The most useful command for this is another of the
_d_i_f_f family, namely _g_i_t _d_i_f_f_-_t_r_e_e.
_g_i_t _d_i_f_f_-_t_r_e_e can be given two arbitrary trees, and it will tell you
the differences between them. Perhaps even more commonly, though, you
can give it just a single commit object, and it will figure out the
parent of that commit itself, and show the difference directly. Thus,
to get the same diff that we’ve already seen several times, we can now
do
$ git diff-tree -p HEAD
(again, --pp means to show the difference as a human-readable patch), and
it will show what the last commit (in HHEEAADD) actually changed.
NNoottee
Here is an ASCII art by Jon Loeliger that illustrates how various
_d_i_f_f_-_* commands compare things.
diff-tree
+----+
| |
| |
V V
+-----------+
| Object DB |
| Backing |
| Store |
+-----------+
^ ^
| |
| | diff-index --cached
| |
diff-index | V
| +-----------+
| | Index |
| | "cache" |
| +-----------+
| ^
| |
| | diff-files
| |
V V
+-----------+
| Working |
| Directory |
+-----------+
More interestingly, you can also give _g_i_t _d_i_f_f_-_t_r_e_e the ----pprreettttyy flag,
which tells it to also show the commit message and author and date of
the commit, and you can tell it to show a whole series of diffs.
Alternatively, you can tell it to be "silent", and not show the diffs
at all, but just show the actual commit message.
In fact, together with the _g_i_t _r_e_v_-_l_i_s_t program (which generates a list
of revisions), _g_i_t _d_i_f_f_-_t_r_e_e ends up being a veritable fount of
changes. You can emulate ggiitt lloogg, ggiitt lloogg --pp, etc. with a trivial
script that pipes the output of ggiitt rreevv--lliisstt to ggiitt ddiiffff--ttrreeee ----ssttddiinn,
which was exactly how early versions of ggiitt lloogg were implemented.
TTAAGGGGIINNGG AA VVEERRSSIIOONN
In Git, there are two kinds of tags, a "light" one, and an "annotated
tag".
A "light" tag is technically nothing more than a branch, except we put
it in the ..ggiitt//rreeffss//ttaaggss// subdirectory instead of calling it a hheeaadd. So
the simplest form of tag involves nothing more than
$ git tag my-first-tag
which just writes the current HHEEAADD into the ..ggiitt//rreeffss//ttaaggss//mmyy--ffiirrsstt--ttaagg
file, after which point you can then use this symbolic name for that
particular state. You can, for example, do
$ git diff my-first-tag
to diff your current state against that tag which at this point will
obviously be an empty diff, but if you continue to develop and commit
stuff, you can use your tag as an "anchor-point" to see what has
changed since you tagged it.
An "annotated tag" is actually a real Git object, and contains not only
a pointer to the state you want to tag, but also a small tag name and
message, along with optionally a PGP signature that says that yes, you
really did that tag. You create these annotated tags with either the --aa
or --ss flag to _g_i_t _t_a_g:
$ git tag -s <tagname>
which will sign the current HHEEAADD (but you can also give it another
argument that specifies the thing to tag, e.g., you could have tagged
the current mmyybbrraanncchh point by using ggiitt ttaagg <<ttaaggnnaammee>> mmyybbrraanncchh).
You normally only do signed tags for major releases or things like
that, while the light-weight tags are useful for any marking you want
to do — any time you decide that you want to remember a certain point,
just create a private tag for it, and you have a nice symbolic name for
the state at that point.
CCOOPPYYIINNGG RREEPPOOSSIITTOORRIIEESS
Git repositories are normally totally self-sufficient and relocatable.
Unlike CVS, for example, there is no separate notion of "repository"
and "working tree". A Git repository normally iiss the working tree, with
the local Git information hidden in the ..ggiitt subdirectory. There is
nothing else. What you see is what you got.
NNoottee
You can tell Git to split the Git internal information from the
directory that it tracks, but we’ll ignore that for now: it’s not
how normal projects work, and it’s really only meant for special
uses. So the mental model of "the Git information is always tied
directly to the working tree that it describes" may not be
technically 100% accurate, but it’s a good model for all normal
use.
This has two implications:
· if you grow bored with the tutorial repository you created (or
you’ve made a mistake and want to start all over), you can just do
simple
$ rm -rf git-tutorial
and it will be gone. There’s no external repository, and there’s no
history outside the project you created.
· if you want to move or duplicate a Git repository, you can do so.
There is _g_i_t _c_l_o_n_e command, but if all you want to do is just to
create a copy of your repository (with all the full history that
went along with it), you can do so with a regular ccpp --aa
ggiitt--ttuuttoorriiaall nneeww--ggiitt--ttuuttoorriiaall.
Note that when you’ve moved or copied a Git repository, your Git
index file (which caches various information, notably some of the
"stat" information for the files involved) will likely need to be
refreshed. So after you do a ccpp --aa to create a new copy, you’ll
want to do
$ git update-index --refresh
in the new repository to make sure that the index file is
up-to-date.
Note that the second point is true even across machines. You can
duplicate a remote Git repository with aannyy regular copy mechanism, be
it _s_c_p, _r_s_y_n_c or _w_g_e_t.
When copying a remote repository, you’ll want to at a minimum update
the index cache when you do this, and especially with other peoples'
repositories you often want to make sure that the index cache is in
some known state (you don’t know wwhhaatt they’ve done and not yet checked
in), so usually you’ll precede the _g_i_t _u_p_d_a_t_e_-_i_n_d_e_x with a
$ git read-tree --reset HEAD
$ git update-index --refresh
which will force a total index re-build from the tree pointed to by
HHEEAADD. It resets the index contents to HHEEAADD, and then the _g_i_t
_u_p_d_a_t_e_-_i_n_d_e_x makes sure to match up all index entries with the
checked-out files. If the original repository had uncommitted changes
in its working tree, ggiitt uuppddaattee--iinnddeexx ----rreeffrreesshh notices them and tells
you they need to be updated.
The above can also be written as simply
$ git reset
and in fact a lot of the common Git command combinations can be
scripted with the ggiitt xxyyzz interfaces. You can learn things by just
looking at what the various git scripts do. For example, ggiitt rreesseett used
to be the above two lines implemented in _g_i_t _r_e_s_e_t, but some things
like _g_i_t _s_t_a_t_u_s and _g_i_t _c_o_m_m_i_t are slightly more complex scripts around
the basic Git commands.
Many (most?) public remote repositories will not contain any of the
checked out files or even an index file, and will oonnllyy contain the
actual core Git files. Such a repository usually doesn’t even have the
..ggiitt subdirectory, but has all the Git files directly in the
repository.
To create your own local live copy of such a "raw" Git repository,
you’d first create your own subdirectory for the project, and then copy
the raw repository contents into the ..ggiitt directory. For example, to
create your own copy of the Git repository, you’d do the following
$ mkdir my-git
$ cd my-git
$ rsync -rL rsync://rsync.kernel.org/pub/scm/git/git.git/ .git
followed by
$ git read-tree HEAD
to populate the index. However, now you have populated the index, and
you have all the Git internal files, but you will notice that you don’t
actually have any of the working tree files to work on. To get those,
you’d check them out with
$ git checkout-index -u -a
where the --uu flag means that you want the checkout to keep the index
up-to-date (so that you don’t have to refresh it afterward), and the --aa
flag means "check out all files" (if you have a stale copy or an older
version of a checked out tree you may also need to add the --ff flag
first, to tell _g_i_t _c_h_e_c_k_o_u_t_-_i_n_d_e_x to ffoorrccee overwriting of any old
files).
Again, this can all be simplified with
$ git clone git://git.kernel.org/pub/scm/git/git.git/ my-git
$ cd my-git
$ git checkout
which will end up doing all of the above for you.
You have now successfully copied somebody else’s (mine) remote
repository, and checked it out.
CCRREEAATTIINNGG AA NNEEWW BBRRAANNCCHH
Branches in Git are really nothing more than pointers into the Git
object database from within the ..ggiitt//rreeffss// subdirectory, and as we
already discussed, the HHEEAADD branch is nothing but a symlink to one of
these object pointers.
You can at any time create a new branch by just picking an arbitrary
point in the project history, and just writing the SHA-1 name of that
object into a file under ..ggiitt//rreeffss//hheeaaddss//. You can use any filename you
want (and indeed, subdirectories), but the convention is that the
"normal" branch is called mmaasstteerr. That’s just a convention, though, and
nothing enforces it.
To show that as an example, let’s go back to the git-tutorial
repository we used earlier, and create a branch in it. You do that by
simply just saying that you want to check out a new branch:
$ git checkout -b mybranch
will create a new branch based at the current HHEEAADD position, and switch
to it.
NNoottee
If you make the decision to start your new branch at some other
point in the history than the current HHEEAADD, you can do so by just
telling _g_i_t _c_h_e_c_k_o_u_t what the base of the checkout would be. In
other words, if you have an earlier tag or branch, you’d just do
$ git checkout -b mybranch earlier-commit
and it would create the new branch mmyybbrraanncchh at the earlier commit,
and check out the state at that time.
You can always just jump back to your original mmaasstteerr branch by doing
$ git checkout master
(or any other branch-name, for that matter) and if you forget which
branch you happen to be on, a simple
$ cat .git/HEAD
will tell you where it’s pointing. To get the list of branches you
have, you can say
$ git branch
which used to be nothing more than a simple script around llss
..ggiitt//rreeffss//hheeaaddss. There will be an asterisk in front of the branch you
are currently on.
Sometimes you may wish to create a new branch _w_i_t_h_o_u_t actually checking
it out and switching to it. If so, just use the command
$ git branch <branchname> [startingpoint]
which will simply _c_r_e_a_t_e the branch, but will not do anything further.
You can then later — once you decide that you want to actually develop
on that branch — switch to that branch with a regular _g_i_t _c_h_e_c_k_o_u_t with
the branchname as the argument.
MMEERRGGIINNGG TTWWOO BBRRAANNCCHHEESS
One of the ideas of having a branch is that you do some (possibly
experimental) work in it, and eventually merge it back to the main
branch. So assuming you created the above mmyybbrraanncchh that started out
being the same as the original mmaasstteerr branch, let’s make sure we’re in
that branch, and do some work there.
$ git checkout mybranch
$ echo "Work, work, work" >>hello
$ git commit -m "Some work." -i hello
Here, we just added another line to hheelllloo, and we used a shorthand for
doing both ggiitt uuppddaattee--iinnddeexx hheelllloo and ggiitt ccoommmmiitt by just giving the
filename directly to ggiitt ccoommmmiitt, with an --ii flag (it tells Git to
_i_n_c_l_u_d_e that file in addition to what you have done to the index file
so far when making the commit). The --mm flag is to give the commit log
message from the command line.
Now, to make it a bit more interesting, let’s assume that somebody else
does some work in the original branch, and simulate that by going back
to the master branch, and editing the same file differently there:
$ git checkout master
Here, take a moment to look at the contents of hheelllloo, and notice how
they don’t contain the work we just did in mmyybbrraanncchh — because that work
hasn’t happened in the mmaasstteerr branch at all. Then do
$ echo "Play, play, play" >>hello
$ echo "Lots of fun" >>example
$ git commit -m "Some fun." -i hello example
since the master branch is obviously in a much better mood.
Now, you’ve got two branches, and you decide that you want to merge the
work done. Before we do that, let’s introduce a cool graphical tool
that helps you view what’s going on:
$ gitk --all
will show you graphically both of your branches (that’s what the ----aallll
means: normally it will just show you your current HHEEAADD) and their
histories. You can also see exactly how they came to be from a common
source.
Anyway, let’s exit _g_i_t_k (^^QQ or the File menu), and decide that we want
to merge the work we did on the mmyybbrraanncchh branch into the mmaasstteerr branch
(which is currently our HHEEAADD too). To do that, there’s a nice script
called _g_i_t _m_e_r_g_e, which wants to know which branches you want to
resolve and what the merge is all about:
$ git merge -m "Merge work in mybranch" mybranch
where the first argument is going to be used as the commit message if
the merge can be resolved automatically.
Now, in this case we’ve intentionally created a situation where the
merge will need to be fixed up by hand, though, so Git will do as much
of it as it can automatically (which in this case is just merge the
eexxaammppllee file, which had no differences in the mmyybbrraanncchh branch), and
say:
Auto-merging hello
CONFLICT (content): Merge conflict in hello
Automatic merge failed; fix conflicts and then commit the result.
It tells you that it did an "Automatic merge", which failed due to
conflicts in hheelllloo.
Not to worry. It left the (trivial) conflict in hheelllloo in the same form
you should already be well used to if you’ve ever used CVS, so let’s
just open hheelllloo in our editor (whatever that may be), and fix it up
somehow. I’d suggest just making it so that hheelllloo contains all four
lines:
Hello World
It's a new day for git
Play, play, play
Work, work, work
and once you’re happy with your manual merge, just do a
$ git commit -i hello
which will very loudly warn you that you’re now committing a merge
(which is correct, so never mind), and you can write a small merge
message about your adventures in _g_i_t _m_e_r_g_e-land.
After you’re done, start up ggiittkk ----aallll to see graphically what the
history looks like. Notice that mmyybbrraanncchh still exists, and you can
switch to it, and continue to work with it if you want to. The mmyybbrraanncchh
branch will not contain the merge, but next time you merge it from the
mmaasstteerr branch, Git will know how you merged it, so you’ll not have to
do _t_h_a_t merge again.
Another useful tool, especially if you do not always work in X-Window
environment, is ggiitt sshhooww--bbrraanncchh.
$ git show-branch --topo-order --more=1 master mybranch
* [master] Merge work in mybranch
! [mybranch] Some work.
--
- [master] Merge work in mybranch
*+ [mybranch] Some work.
* [master^] Some fun.
The first two lines indicate that it is showing the two branches with
the titles of their top-of-the-tree commits, you are currently on
mmaasstteerr branch (notice the asterisk ** character), and the first column
for the later output lines is used to show commits contained in the
mmaasstteerr branch, and the second column for the mmyybbrraanncchh branch. Three
commits are shown along with their titles. All of them have non blank
characters in the first column (** shows an ordinary commit on the
current branch, -- is a merge commit), which means they are now part of
the mmaasstteerr branch. Only the "Some work" commit has the plus ++ character
in the second column, because mmyybbrraanncchh has not been merged to
incorporate these commits from the master branch. The string inside
brackets before the commit log message is a short name you can use to
name the commit. In the above example, _m_a_s_t_e_r and _m_y_b_r_a_n_c_h are branch
heads. _m_a_s_t_e_r_^ is the first parent of _m_a_s_t_e_r branch head. Please see
ggiittrreevviissiioonnss(7) if you want to see more complex cases.
NNoottee
Without the _-_-_m_o_r_e_=_1 option, _g_i_t _s_h_o_w_-_b_r_a_n_c_h would not output the
_[_m_a_s_t_e_r_^_] commit, as _[_m_y_b_r_a_n_c_h_] commit is a common ancestor of both
_m_a_s_t_e_r and _m_y_b_r_a_n_c_h tips. Please see ggiitt--sshhooww--bbrraanncchh(1) for
details.
NNoottee
If there were more commits on the _m_a_s_t_e_r branch after the merge,
the merge commit itself would not be shown by _g_i_t _s_h_o_w_-_b_r_a_n_c_h by
default. You would need to provide ----ssppaarrssee option to make the
merge commit visible in this case.
Now, let’s pretend you are the one who did all the work in mmyybbrraanncchh,
and the fruit of your hard work has finally been merged to the mmaasstteerr
branch. Let’s go back to mmyybbrraanncchh, and run _g_i_t _m_e_r_g_e to get the
"upstream changes" back to your branch.
$ git checkout mybranch
$ git merge -m "Merge upstream changes." master
This outputs something like this (the actual commit object names would
be different)
Updating from ae3a2da... to a80b4aa....
Fast-forward (no commit created; -m option ignored)
example | 1 +
hello | 1 +
2 files changed, 2 insertions(+)
Because your branch did not contain anything more than what had already
been merged into the mmaasstteerr branch, the merge operation did not
actually do a merge. Instead, it just updated the top of the tree of
your branch to that of the mmaasstteerr branch. This is often called
_f_a_s_t_-_f_o_r_w_a_r_d merge.
You can run ggiittkk ----aallll again to see how the commit ancestry looks like,
or run _s_h_o_w_-_b_r_a_n_c_h, which tells you this.
$ git show-branch master mybranch
! [master] Merge work in mybranch
* [mybranch] Merge work in mybranch
--
-- [master] Merge work in mybranch
MMEERRGGIINNGG EEXXTTEERRNNAALL WWOORRKK
It’s usually much more common that you merge with somebody else than
merging with your own branches, so it’s worth pointing out that Git
makes that very easy too, and in fact, it’s not that different from
doing a _g_i_t _m_e_r_g_e. In fact, a remote merge ends up being nothing more
than "fetch the work from a remote repository into a temporary tag"
followed by a _g_i_t _m_e_r_g_e.
Fetching from a remote repository is done by, unsurprisingly, _g_i_t
_f_e_t_c_h:
$ git fetch <remote-repository>
One of the following transports can be used to name the repository to
download from:
SSH
rreemmoottee..mmaacchhiinnee:://ppaatthh//ttoo//rreeppoo..ggiitt// or
sssshh::////rreemmoottee..mmaacchhiinnee//ppaatthh//ttoo//rreeppoo..ggiitt//
This transport can be used for both uploading and downloading, and
requires you to have a log-in privilege over sssshh to the remote
machine. It finds out the set of objects the other side lacks by
exchanging the head commits both ends have and transfers (close to)
minimum set of objects. It is by far the most efficient way to
exchange Git objects between repositories.
Local directory
//ppaatthh//ttoo//rreeppoo..ggiitt//
This transport is the same as SSH transport but uses _s_h to run both
ends on the local machine instead of running other end on the
remote machine via _s_s_h.
Git Native
ggiitt::////rreemmoottee..mmaacchhiinnee//ppaatthh//ttoo//rreeppoo..ggiitt//
This transport was designed for anonymous downloading. Like SSH
transport, it finds out the set of objects the downstream side
lacks and transfers (close to) minimum set of objects.
HTTP(S)
hhttttpp::////rreemmoottee..mmaacchhiinnee//ppaatthh//ttoo//rreeppoo..ggiitt//
Downloader from http and https URL first obtains the topmost commit
object name from the remote site by looking at the specified
refname under rreeppoo..ggiitt//rreeffss// directory, and then tries to obtain
the commit object by downloading from rreeppoo..ggiitt//oobbjjeeccttss//xxxx//xxxxxx......
using the object name of that commit object. Then it reads the
commit object to find out its parent commits and the associate tree
object; it repeats this process until it gets all the necessary
objects. Because of this behavior, they are sometimes also called
_c_o_m_m_i_t _w_a_l_k_e_r_s.
The _c_o_m_m_i_t _w_a_l_k_e_r_s are sometimes also called _d_u_m_b _t_r_a_n_s_p_o_r_t_s,
because they do not require any Git aware smart server like Git
Native transport does. Any stock HTTP server that does not even
support directory index would suffice. But you must prepare your
repository with _g_i_t _u_p_d_a_t_e_-_s_e_r_v_e_r_-_i_n_f_o to help dumb transport
downloaders.
Once you fetch from the remote repository, you mmeerrggee that with your
current branch.
However — it’s such a common thing to ffeettcchh and then immediately mmeerrggee,
that it’s called ggiitt ppuullll, and you can simply do
$ git pull <remote-repository>
and optionally give a branch-name for the remote end as a second
argument.
NNoottee
You could do without using any branches at all, by keeping as many
local repositories as you would like to have branches, and merging
between them with _g_i_t _p_u_l_l, just like you merge between branches.
The advantage of this approach is that it lets you keep a set of
files for each bbrraanncchh checked out and you may find it easier to
switch back and forth if you juggle multiple lines of development
simultaneously. Of course, you will pay the price of more disk
usage to hold multiple working trees, but disk space is cheap these
days.
It is likely that you will be pulling from the same remote repository
from time to time. As a short hand, you can store the remote repository
URL in the local repository’s config file like this:
$ git config remote.linus.url http://www.kernel.org/pub/scm/git/git.git/
and use the "linus" keyword with _g_i_t _p_u_l_l instead of the full URL.
Examples.
1. ggiitt ppuullll lliinnuuss
2. ggiitt ppuullll lliinnuuss ttaagg vv00..9999..11
the above are equivalent to:
1. ggiitt ppuullll hhttttpp::////wwwwww..kkeerrnneell..oorrgg//ppuubb//ssccmm//ggiitt//ggiitt..ggiitt// HHEEAADD
2. ggiitt ppuullll hhttttpp::////wwwwww..kkeerrnneell..oorrgg//ppuubb//ssccmm//ggiitt//ggiitt..ggiitt// ttaagg vv00..9999..11
HHOOWW DDOOEESS TTHHEE MMEERRGGEE WWOORRKK??
We said this tutorial shows what plumbing does to help you cope with
the porcelain that isn’t flushing, but we so far did not talk about how
the merge really works. If you are following this tutorial the first
time, I’d suggest to skip to "Publishing your work" section and come
back here later.
OK, still with me? To give us an example to look at, let’s go back to
the earlier repository with "hello" and "example" file, and bring
ourselves back to the pre-merge state:
$ git show-branch --more=2 master mybranch
! [master] Merge work in mybranch
* [mybranch] Merge work in mybranch
--
-- [master] Merge work in mybranch
+* [master^2] Some work.
+* [master^] Some fun.
Remember, before running _g_i_t _m_e_r_g_e, our mmaasstteerr head was at "Some fun."
commit, while our mmyybbrraanncchh head was at "Some work." commit.
$ git checkout mybranch
$ git reset --hard master^2
$ git checkout master
$ git reset --hard master^
After rewinding, the commit structure should look like this:
$ git show-branch
* [master] Some fun.
! [mybranch] Some work.
--
* [master] Some fun.
+ [mybranch] Some work.
*+ [master^] Initial commit
Now we are ready to experiment with the merge by hand.
ggiitt mmeerrggee command, when merging two branches, uses 3-way merge
algorithm. First, it finds the common ancestor between them. The
command it uses is _g_i_t _m_e_r_g_e_-_b_a_s_e:
$ mb=$(git merge-base HEAD mybranch)
The command writes the commit object name of the common ancestor to the
standard output, so we captured its output to a variable, because we
will be using it in the next step. By the way, the common ancestor
commit is the "Initial commit" commit in this case. You can tell it by:
$ git name-rev --name-only --tags $mb
my-first-tag
After finding out a common ancestor commit, the second step is this:
$ git read-tree -m -u $mb HEAD mybranch
This is the same _g_i_t _r_e_a_d_-_t_r_e_e command we have already seen, but it
takes three trees, unlike previous examples. This reads the contents of
each tree into different _s_t_a_g_e in the index file (the first tree goes
to stage 1, the second to stage 2, etc.). After reading three trees
into three stages, the paths that are the same in all three stages are
_c_o_l_l_a_p_s_e_d into stage 0. Also paths that are the same in two of three
stages are collapsed into stage 0, taking the SHA-1 from either stage 2
or stage 3, whichever is different from stage 1 (i.e. only one side
changed from the common ancestor).
After _c_o_l_l_a_p_s_i_n_g operation, paths that are different in three trees are
left in non-zero stages. At this point, you can inspect the index file
with this command:
$ git ls-files --stage
100644 7f8b141b65fdcee47321e399a2598a235a032422 0 example
100644 557db03de997c86a4a028e1ebd3a1ceb225be238 1 hello
100644 ba42a2a96e3027f3333e13ede4ccf4498c3ae942 2 hello
100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello
In our example of only two files, we did not have unchanged files so
only _e_x_a_m_p_l_e resulted in collapsing. But in real-life large projects,
when only a small number of files change in one commit, this _c_o_l_l_a_p_s_i_n_g
tends to trivially merge most of the paths fairly quickly, leaving only
a handful of real changes in non-zero stages.
To look at only non-zero stages, use ----uunnmmeerrggeedd flag:
$ git ls-files --unmerged
100644 557db03de997c86a4a028e1ebd3a1ceb225be238 1 hello
100644 ba42a2a96e3027f3333e13ede4ccf4498c3ae942 2 hello
100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello
The next step of merging is to merge these three versions of the file,
using 3-way merge. This is done by giving _g_i_t _m_e_r_g_e_-_o_n_e_-_f_i_l_e command as
one of the arguments to _g_i_t _m_e_r_g_e_-_i_n_d_e_x command:
$ git merge-index git-merge-one-file hello
Auto-merging hello
ERROR: Merge conflict in hello
fatal: merge program failed
_g_i_t _m_e_r_g_e_-_o_n_e_-_f_i_l_e script is called with parameters to describe those
three versions, and is responsible to leave the merge results in the
working tree. It is a fairly straightforward shell script, and
eventually calls _m_e_r_g_e program from RCS suite to perform a file-level
3-way merge. In this case, _m_e_r_g_e detects conflicts, and the merge
result with conflict marks is left in the working tree.. This can be
seen if you run llss--ffiilleess ----ssttaaggee again at this point:
$ git ls-files --stage
100644 7f8b141b65fdcee47321e399a2598a235a032422 0 example
100644 557db03de997c86a4a028e1ebd3a1ceb225be238 1 hello
100644 ba42a2a96e3027f3333e13ede4ccf4498c3ae942 2 hello
100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello
This is the state of the index file and the working file after _g_i_t
_m_e_r_g_e returns control back to you, leaving the conflicting merge for
you to resolve. Notice that the path hheelllloo is still unmerged, and what
you see with _g_i_t _d_i_f_f at this point is differences since stage 2 (i.e.
your version).
PPUUBBLLIISSHHIINNGG YYOOUURR WWOORRKK
So, we can use somebody else’s work from a remote repository, but how
can yyoouu prepare a repository to let other people pull from it?
You do your real work in your working tree that has your primary
repository hanging under it as its ..ggiitt subdirectory. You ccoouulldd make
that repository accessible remotely and ask people to pull from it, but
in practice that is not the way things are usually done. A recommended
way is to have a public repository, make it reachable by other people,
and when the changes you made in your primary working tree are in good
shape, update the public repository from it. This is often called
_p_u_s_h_i_n_g.
NNoottee
This public repository could further be mirrored, and that is how
Git repositories at kkeerrnneell..oorrgg are managed.
Publishing the changes from your local (private) repository to your
remote (public) repository requires a write privilege on the remote
machine. You need to have an SSH account there to run a single command,
_g_i_t_-_r_e_c_e_i_v_e_-_p_a_c_k.
First, you need to create an empty repository on the remote machine
that will house your public repository. This empty repository will be
populated and be kept up-to-date by pushing into it later. Obviously,
this repository creation needs to be done only once.
NNoottee
_g_i_t _p_u_s_h uses a pair of commands, _g_i_t _s_e_n_d_-_p_a_c_k on your local
machine, and _g_i_t_-_r_e_c_e_i_v_e_-_p_a_c_k on the remote machine. The
communication between the two over the network internally uses an
SSH connection.
Your private repository’s Git directory is usually ..ggiitt, but your
public repository is often named after the project name, i.e.
<<pprroojjeecctt>>..ggiitt. Let’s create such a public repository for project
mmyy--ggiitt. After logging into the remote machine, create an empty
directory:
$ mkdir my-git.git
Then, make that directory into a Git repository by running _g_i_t _i_n_i_t,
but this time, since its name is not the usual ..ggiitt, we do things
slightly differently:
$ GIT_DIR=my-git.git git init
Make sure this directory is available for others you want your changes
to be pulled via the transport of your choice. Also you need to make
sure that you have the _g_i_t_-_r_e_c_e_i_v_e_-_p_a_c_k program on the $$PPAATTHH.
NNoottee
Many installations of sshd do not invoke your shell as the login
shell when you directly run programs; what this means is that if
your login shell is _b_a_s_h, only ..bbaasshhrrcc is read and not
..bbaasshh__pprrooffiillee. As a workaround, make sure ..bbaasshhrrcc sets up $$PPAATTHH so
that you can run _g_i_t_-_r_e_c_e_i_v_e_-_p_a_c_k program.
NNoottee
If you plan to publish this repository to be accessed over http,
you should do mmvv mmyy--ggiitt..ggiitt//hhooookkss//ppoosstt--uuppddaattee..ssaammppllee
mmyy--ggiitt..ggiitt//hhooookkss//ppoosstt--uuppddaattee at this point. This makes sure that
every time you push into this repository, ggiitt uuppddaattee--sseerrvveerr--iinnffoo is
run.
Your "public repository" is now ready to accept your changes. Come back
to the machine you have your private repository. From there, run this
command:
$ git push <public-host>:/path/to/my-git.git master
This synchronizes your public repository to match the named branch head
(i.e. mmaasstteerr in this case) and objects reachable from them in your
current repository.
As a real example, this is how I update my public Git repository.
Kernel.org mirror network takes care of the propagation to other
publicly visible machines:
$ git push master.kernel.org:/pub/scm/git/git.git/
PPAACCKKIINNGG YYOOUURR RREEPPOOSSIITTOORRYY
Earlier, we saw that one file under ..ggiitt//oobbjjeeccttss//????// directory is
stored for each Git object you create. This representation is efficient
to create atomically and safely, but not so convenient to transport
over the network. Since Git objects are immutable once they are
created, there is a way to optimize the storage by "packing them
together". The command
$ git repack
will do it for you. If you followed the tutorial examples, you would
have accumulated about 17 objects in ..ggiitt//oobbjjeeccttss//????// directories by
now. _g_i_t _r_e_p_a_c_k tells you how many objects it packed, and stores the
packed file in the ..ggiitt//oobbjjeeccttss//ppaacckk directory.
NNoottee
You will see two files, ppaacckk--**..ppaacckk and ppaacckk--**..iiddxx, in
..ggiitt//oobbjjeeccttss//ppaacckk directory. They are closely related to each
other, and if you ever copy them by hand to a different repository
for whatever reason, you should make sure you copy them together.
The former holds all the data from the objects in the pack, and the
latter holds the index for random access.
If you are paranoid, running _g_i_t _v_e_r_i_f_y_-_p_a_c_k command would detect if
you have a corrupt pack, but do not worry too much. Our programs are
always perfect ;-).
Once you have packed objects, you do not need to leave the unpacked
objects that are contained in the pack file anymore.
$ git prune-packed
would remove them for you.
You can try running ffiinndd ..ggiitt//oobbjjeeccttss --ttyyppee ff before and after you run
ggiitt pprruunnee--ppaacckkeedd if you are curious. Also ggiitt ccoouunntt--oobbjjeeccttss would tell
you how many unpacked objects are in your repository and how much space
they are consuming.
NNoottee
ggiitt ppuullll is slightly cumbersome for HTTP transport, as a packed
repository may contain relatively few objects in a relatively large
pack. If you expect many HTTP pulls from your public repository you
might want to repack & prune often, or never.
If you run ggiitt rreeppaacckk again at this point, it will say "Nothing new to
pack.". Once you continue your development and accumulate the changes,
running ggiitt rreeppaacckk again will create a new pack, that contains objects
created since you packed your repository the last time. We recommend
that you pack your project soon after the initial import (unless you
are starting your project from scratch), and then run ggiitt rreeppaacckk every
once in a while, depending on how active your project is.
When a repository is synchronized via ggiitt ppuusshh and ggiitt ppuullll objects
packed in the source repository are usually stored unpacked in the
destination. While this allows you to use different packing strategies
on both ends, it also means you may need to repack both repositories
every once in a while.
WWOORRKKIINNGG WWIITTHH OOTTHHEERRSS
Although Git is a truly distributed system, it is often convenient to
organize your project with an informal hierarchy of developers. Linux
kernel development is run this way. There is a nice illustration (page
17, "Merges to Mainline") in RRaannddyy DDuunnllaapp’’ss pprreesseennttaattiioonn[2].
It should be stressed that this hierarchy is purely iinnffoorrmmaall. There is
nothing fundamental in Git that enforces the "chain of patch flow" this
hierarchy implies. You do not have to pull from only one remote
repository.
A recommended workflow for a "project lead" goes like this:
1. Prepare your primary repository on your local machine. Your work is
done there.
2. Prepare a public repository accessible to others.
If other people are pulling from your repository over dumb
transport protocols (HTTP), you need to keep this repository _d_u_m_b
_t_r_a_n_s_p_o_r_t _f_r_i_e_n_d_l_y. After ggiitt iinniitt,
$$GGIITT__DDIIRR//hhooookkss//ppoosstt--uuppddaattee..ssaammppllee copied from the standard
templates would contain a call to _g_i_t _u_p_d_a_t_e_-_s_e_r_v_e_r_-_i_n_f_o but you
need to manually enable the hook with mmvv ppoosstt--uuppddaattee..ssaammppllee
ppoosstt--uuppddaattee. This makes sure _g_i_t _u_p_d_a_t_e_-_s_e_r_v_e_r_-_i_n_f_o keeps the
necessary files up-to-date.
3. Push into the public repository from your primary repository.
4. _g_i_t _r_e_p_a_c_k the public repository. This establishes a big pack that
contains the initial set of objects as the baseline, and possibly
_g_i_t _p_r_u_n_e if the transport used for pulling from your repository
supports packed repositories.
5. Keep working in your primary repository. Your changes include
modifications of your own, patches you receive via e-mails, and
merges resulting from pulling the "public" repositories of your
"subsystem maintainers".
You can repack this private repository whenever you feel like.
6. Push your changes to the public repository, and announce it to the
public.
7. Every once in a while, _g_i_t _r_e_p_a_c_k the public repository. Go back to
step 5. and continue working.
A recommended work cycle for a "subsystem maintainer" who works on that
project and has an own "public repository" goes like this:
1. Prepare your work repository, by running _g_i_t _c_l_o_n_e on the public
repository of the "project lead". The URL used for the initial
cloning is stored in the remote.origin.url configuration variable.
2. Prepare a public repository accessible to others, just like the
"project lead" person does.
3. Copy over the packed files from "project lead" public repository to
your public repository, unless the "project lead" repository lives
on the same machine as yours. In the latter case, you can use
oobbjjeeccttss//iinnffoo//aalltteerrnnaatteess file to point at the repository you are
borrowing from.
4. Push into the public repository from your primary repository. Run
_g_i_t _r_e_p_a_c_k, and possibly _g_i_t _p_r_u_n_e if the transport used for
pulling from your repository supports packed repositories.
5. Keep working in your primary repository. Your changes include
modifications of your own, patches you receive via e-mails, and
merges resulting from pulling the "public" repositories of your
"project lead" and possibly your "sub-subsystem maintainers".
You can repack this private repository whenever you feel like.
6. Push your changes to your public repository, and ask your "project
lead" and possibly your "sub-subsystem maintainers" to pull from
it.
7. Every once in a while, _g_i_t _r_e_p_a_c_k the public repository. Go back to
step 5. and continue working.
A recommended work cycle for an "individual developer" who does not
have a "public" repository is somewhat different. It goes like this:
1. Prepare your work repository, by _g_i_t _c_l_o_n_e the public repository of
the "project lead" (or a "subsystem maintainer", if you work on a
subsystem). The URL used for the initial cloning is stored in the
remote.origin.url configuration variable.
2. Do your work in your repository on _m_a_s_t_e_r branch.
3. Run ggiitt ffeettcchh oorriiggiinn from the public repository of your upstream
every once in a while. This does only the first half of ggiitt ppuullll
but does not merge. The head of the public repository is stored in
..ggiitt//rreeffss//rreemmootteess//oorriiggiinn//mmaasstteerr.
4. Use ggiitt cchheerrrryy oorriiggiinn to see which ones of your patches were
accepted, and/or use ggiitt rreebbaassee oorriiggiinn to port your unmerged
changes forward to the updated upstream.
5. Use ggiitt ffoorrmmaatt--ppaattcchh oorriiggiinn to prepare patches for e-mail
submission to your upstream and send it out. Go back to step 2. and
continue.
WWOORRKKIINNGG WWIITTHH OOTTHHEERRSS,, SSHHAARREEDD RREEPPOOSSIITTOORRYY SSTTYYLLEE
If you are coming from a CVS background, the style of cooperation
suggested in the previous section may be new to you. You do not have to
worry. Git supports the "shared public repository" style of cooperation
you are probably more familiar with as well.
See ggiittccvvss--mmiiggrraattiioonn(7) for the details.
BBUUNNDDLLIINNGG YYOOUURR WWOORRKK TTOOGGEETTHHEERR
It is likely that you will be working on more than one thing at a time.
It is easy to manage those more-or-less independent tasks using
branches with Git.
We have already seen how branches work previously, with "fun and work"
example using two branches. The idea is the same if there are more than
two branches. Let’s say you started out from "master" head, and have
some new code in the "master" branch, and two independent fixes in the
"commit-fix" and "diff-fix" branches:
$ git show-branch
! [commit-fix] Fix commit message normalization.
! [diff-fix] Fix rename detection.
* [master] Release candidate #1
---
+ [diff-fix] Fix rename detection.
+ [diff-fix~1] Better common substring algorithm.
+ [commit-fix] Fix commit message normalization.
* [master] Release candidate #1
++* [diff-fix~2] Pretty-print messages.
Both fixes are tested well, and at this point, you want to merge in
both of them. You could merge in _d_i_f_f_-_f_i_x first and then _c_o_m_m_i_t_-_f_i_x
next, like this:
$ git merge -m "Merge fix in diff-fix" diff-fix
$ git merge -m "Merge fix in commit-fix" commit-fix
Which would result in:
$ git show-branch
! [commit-fix] Fix commit message normalization.
! [diff-fix] Fix rename detection.
* [master] Merge fix in commit-fix
---
- [master] Merge fix in commit-fix
+ * [commit-fix] Fix commit message normalization.
- [master~1] Merge fix in diff-fix
+* [diff-fix] Fix rename detection.
+* [diff-fix~1] Better common substring algorithm.
* [master~2] Release candidate #1
++* [master~3] Pretty-print messages.
However, there is no particular reason to merge in one branch first and
the other next, when what you have are a set of truly independent
changes (if the order mattered, then they are not independent by
definition). You could instead merge those two branches into the
current branch at once. First let’s undo what we just did and start
over. We would want to get the master branch before these two merges by
resetting it to _m_a_s_t_e_r_~_2:
$ git reset --hard master~2
You can make sure ggiitt sshhooww--bbrraanncchh matches the state before those two
_g_i_t _m_e_r_g_e you just did. Then, instead of running two _g_i_t _m_e_r_g_e commands
in a row, you would merge these two branch heads (this is known as
_m_a_k_i_n_g _a_n _O_c_t_o_p_u_s):
$ git merge commit-fix diff-fix
$ git show-branch
! [commit-fix] Fix commit message normalization.
! [diff-fix] Fix rename detection.
* [master] Octopus merge of branches 'diff-fix' and 'commit-fix'
---
- [master] Octopus merge of branches 'diff-fix' and 'commit-fix'
+ * [commit-fix] Fix commit message normalization.
+* [diff-fix] Fix rename detection.
+* [diff-fix~1] Better common substring algorithm.
* [master~1] Release candidate #1
++* [master~2] Pretty-print messages.
Note that you should not do Octopus just because you can. An octopus is
a valid thing to do and often makes it easier to view the commit
history if you are merging more than two independent changes at the
same time. However, if you have merge conflicts with any of the
branches you are merging in and need to hand resolve, that is an
indication that the development happened in those branches were not
independent after all, and you should merge two at a time, documenting
how you resolved the conflicts, and the reason why you preferred
changes made in one side over the other. Otherwise it would make the
project history harder to follow, not easier.
SSEEEE AALLSSOO
ggiittttuuttoorriiaall(7), ggiittttuuttoorriiaall--22(7), ggiittccvvss--mmiiggrraattiioonn(7), ggiitt--hheellpp(1),
ggiitteevveerryyddaayy(7), TThhee GGiitt UUsseerr’’ss MMaannuuaall[1]
GGIITT
Part of the ggiitt(1) suite
NNOOTTEESS
1. the Git User Manual
git-htmldocs/user-manual.html
2. Randy Dunlap’s presentation
https://web.archive.org/web/20120915203609/http://www.xenotime.net/linux/mentor/linux-mentoring-2006.pdf
Git 2.13.6 09/24/2017 GITCORE-TUTORIAL(7)
git help glossary
GITGLOSSARY(7) Git Manual GITGLOSSARY(7)
NNAAMMEE
gitglossary - A Git Glossary
SSYYNNOOPPSSIISS
*
DDEESSCCRRIIPPTTIIOONN
alternate object database
Via the alternates mechanism, a repository can inherit part of its
object database from another object database, which is called an
"alternate".
bare repository
A bare repository is normally an appropriately named directory with
a ..ggiitt suffix that does not have a locally checked-out copy of any
of the files under revision control. That is, all of the Git
administrative and control files that would normally be present in
the hidden ..ggiitt sub-directory are directly present in the
rreeppoossiittoorryy..ggiitt directory instead, and no other files are present
and checked out. Usually publishers of public repositories make
bare repositories available.
blob object
Untyped object, e.g. the contents of a file.
branch
A "branch" is an active line of development. The most recent commit
on a branch is referred to as the tip of that branch. The tip of
the branch is referenced by a branch head, which moves forward as
additional development is done on the branch. A single Git
repository can track an arbitrary number of branches, but your
working tree is associated with just one of them (the "current" or
"checked out" branch), and HEAD points to that branch.
cache
Obsolete for: index.
chain
A list of objects, where each object in the list contains a
reference to its successor (for example, the successor of a commit
could be one of its parents).
changeset
BitKeeper/cvsps speak for "commit". Since Git does not store
changes, but states, it really does not make sense to use the term
"changesets" with Git.
checkout
The action of updating all or part of the working tree with a tree
object or blob from the object database, and updating the index and
HEAD if the whole working tree has been pointed at a new branch.
cherry-picking
In SCM jargon, "cherry pick" means to choose a subset of changes
out of a series of changes (typically commits) and record them as a
new series of changes on top of a different codebase. In Git, this
is performed by the "git cherry-pick" command to extract the change
introduced by an existing commit and to record it based on the tip
of the current branch as a new commit.
clean
A working tree is clean, if it corresponds to the revision
referenced by the current head. Also see "dirty".
commit
As a noun: A single point in the Git history; the entire history of
a project is represented as a set of interrelated commits. The word
"commit" is often used by Git in the same places other revision
control systems use the words "revision" or "version". Also used as
a short hand for commit object.
As a verb: The action of storing a new snapshot of the project’s
state in the Git history, by creating a new commit representing the
current state of the index and advancing HEAD to point at the new
commit.
commit object
An object which contains the information about a particular
revision, such as parents, committer, author, date and the tree
object which corresponds to the top directory of the stored
revision.
commit-ish (also committish)
A commit object or an object that can be recursively dereferenced
to a commit object. The following are all commit-ishes: a commit
object, a tag object that points to a commit object, a tag object
that points to a tag object that points to a commit object, etc.
core Git
Fundamental data structures and utilities of Git. Exposes only
limited source code management tools.
DAG
Directed acyclic graph. The commit objects form a directed acyclic
graph, because they have parents (directed), and the graph of
commit objects is acyclic (there is no chain which begins and ends
with the same object).
dangling object
An unreachable object which is not reachable even from other
unreachable objects; a dangling object has no references to it from
any reference or object in the repository.
detached HEAD
Normally the HEAD stores the name of a branch, and commands that
operate on the history HEAD represents operate on the history
leading to the tip of the branch the HEAD points at. However, Git
also allows you to check out an arbitrary commit that isn’t
necessarily the tip of any particular branch. The HEAD in such a
state is called "detached".
Note that commands that operate on the history of the current
branch (e.g. ggiitt ccoommmmiitt to build a new history on top of it) still
work while the HEAD is detached. They update the HEAD to point at
the tip of the updated history without affecting any branch.
Commands that update or inquire information _a_b_o_u_t the current
branch (e.g. ggiitt bbrraanncchh ----sseett--uuppssttrreeaamm--ttoo that sets what
remote-tracking branch the current branch integrates with)
obviously do not work, as there is no (real) current branch to ask
about in this state.
directory
The list you get with "ls" :-)
dirty
A working tree is said to be "dirty" if it contains modifications
which have not been committed to the current branch.
evil merge
An evil merge is a merge that introduces changes that do not appear
in any parent.
fast-forward
A fast-forward is a special type of merge where you have a revision
and you are "merging" another branch's changes that happen to be a
descendant of what you have. In such a case, you do not make a new
mergecommit but instead just update to his revision. This will
happen frequently on a remote-tracking branch of a remote
repository.
fetch
Fetching a branch means to get the branch’s head ref from a remote
repository, to find out which objects are missing from the local
object database, and to get them, too. See also ggiitt--ffeettcchh(1).
file system
Linus Torvalds originally designed Git to be a user space file
system, i.e. the infrastructure to hold files and directories. That
ensured the efficiency and speed of Git.
Git archive
Synonym for repository (for arch people).
gitfile
A plain file ..ggiitt at the root of a working tree that points at the
directory that is the real repository.
grafts
Grafts enables two otherwise different lines of development to be
joined together by recording fake ancestry information for commits.
This way you can make Git pretend the set of parents a commit has
is different from what was recorded when the commit was created.
Configured via the ..ggiitt//iinnffoo//ggrraaffttss file.
Note that the grafts mechanism is outdated and can lead to problems
transferring objects between repositories; see ggiitt--rreeppllaaccee(1) for a
more flexible and robust system to do the same thing.
hash
In Git’s context, synonym for object name.
head
A named reference to the commit at the tip of a branch. Heads are
stored in a file in $$GGIITT__DDIIRR//rreeffss//hheeaaddss// directory, except when
using packed refs. (See ggiitt--ppaacckk--rreeffss(1).)
HEAD
The current branch. In more detail: Your working tree is normally
derived from the state of the tree referred to by HEAD. HEAD is a
reference to one of the heads in your repository, except when using
a detached HEAD, in which case it directly references an arbitrary
commit.
head ref
A synonym for head.
hook
During the normal execution of several Git commands, call-outs are
made to optional scripts that allow a developer to add
functionality or checking. Typically, the hooks allow for a command
to be pre-verified and potentially aborted, and allow for a
post-notification after the operation is done. The hook scripts are
found in the $$GGIITT__DDIIRR//hhooookkss// directory, and are enabled by simply
removing the ..ssaammppllee suffix from the filename. In earlier versions
of Git you had to make them executable.
index
A collection of files with stat information, whose contents are
stored as objects. The index is a stored version of your working
tree. Truth be told, it can also contain a second, and even a third
version of a working tree, which are used when merging.
index entry
The information regarding a particular file, stored in the index.
An index entry can be unmerged, if a merge was started, but not yet
finished (i.e. if the index contains multiple versions of that
file).
master
The default development branch. Whenever you create a Git
repository, a branch named "master" is created, and becomes the
active branch. In most cases, this contains the local development,
though that is purely by convention and is not required.
merge
As a verb: To bring the contents of another branch (possibly from
an external repository) into the current branch. In the case where
the merged-in branch is from a different repository, this is done
by first fetching the remote branch and then merging the result
into the current branch. This combination of fetch and merge
operations is called a pull. Merging is performed by an automatic
process that identifies changes made since the branches diverged,
and then applies all those changes together. In cases where changes
conflict, manual intervention may be required to complete the
merge.
As a noun: unless it is a fast-forward, a successful merge results
in the creation of a new commit representing the result of the
merge, and having as parents the tips of the merged branches. This
commit is referred to as a "merge commit", or sometimes just a
"merge".
object
The unit of storage in Git. It is uniquely identified by the SHA-1
of its contents. Consequently, an object can not be changed.
object database
Stores a set of "objects", and an individual object is identified
by its object name. The objects usually live in $$GGIITT__DDIIRR//oobbjjeeccttss//.
object identifier
Synonym for object name.
object name
The unique identifier of an object. The object name is usually
represented by a 40 character hexadecimal string. Also colloquially
called SHA-1.
object type
One of the identifiers "commit", "tree", "tag" or "blob" describing
the type of an object.
octopus
To merge more than two branches.
origin
The default upstream repository. Most projects have at least one
upstream project which they track. By default _o_r_i_g_i_n is used for
that purpose. New upstream updates will be fetched into remote-
tracking branches named origin/name-of-upstream-branch, which you
can see using ggiitt bbrraanncchh --rr.
pack
A set of objects which have been compressed into one file (to save
space or to transmit them efficiently).
pack index
The list of identifiers, and other information, of the objects in a
pack, to assist in efficiently accessing the contents of a pack.
pathspec
Pattern used to limit paths in Git commands.
Pathspecs are used on the command line of "git ls-files", "git
ls-tree", "git add", "git grep", "git diff", "git checkout", and
many other commands to limit the scope of operations to some subset
of the tree or worktree. See the documentation of each command for
whether paths are relative to the current directory or toplevel.
The pathspec syntax is as follows:
· any path matches itself
· the pathspec up to the last slash represents a directory
prefix. The scope of that pathspec is limited to that subtree.
· the rest of the pathspec is a pattern for the remainder of the
pathname. Paths relative to the directory prefix will be
matched against that pattern using fnmatch(3); in particular, _*
and _?_c_a_n match directory separators.
For example, Documentation/*.jpg will match all .jpg files in the
Documentation subtree, including
Documentation/chapter_1/figure_1.jpg.
A pathspec that begins with a colon :: has special meaning. In the
short form, the leading colon :: is followed by zero or more "magic
signature" letters (which optionally is terminated by another colon
::), and the remainder is the pattern to match against the path. The
"magic signature" consists of ASCII symbols that are neither
alphanumeric, glob, regex special characters nor colon. The
optional colon that terminates the "magic signature" can be omitted
if the pattern begins with a character that does not belong to
"magic signature" symbol set and is not a colon.
In the long form, the leading colon :: is followed by a open
parenthesis ((, a comma-separated list of zero or more "magic
words", and a close parentheses )), and the remainder is the pattern
to match against the path.
A pathspec with only a colon means "there is no pathspec". This
form should not be combined with other pathspec.
top
The magic word ttoopp (magic signature: //) makes the pattern match
from the root of the working tree, even when you are running
the command from inside a subdirectory.
literal
Wildcards in the pattern such as ** or ?? are treated as literal
characters.
icase
Case insensitive match.
glob
Git treats the pattern as a shell glob suitable for consumption
by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the
pattern will not match a / in the pathname. For example,
"Documentation/*.html" matches "Documentation/git.html" but not
"Documentation/ppc/ppc.html" or
"tools/perf/Documentation/perf.html".
Two consecutive asterisks ("****") in patterns matched against
full pathname may have special meaning:
· A leading "****" followed by a slash means match in all
directories. For example, "****//ffoooo" matches file or
directory "ffoooo" anywhere, the same as pattern "ffoooo".
"****//ffoooo//bbaarr" matches file or directory "bbaarr" anywhere that
is directly under directory "ffoooo".
· A trailing "//****" matches everything inside. For example,
"aabbcc//****" matches all files inside directory "abc", relative
to the location of the ..ggiittiiggnnoorree file, with infinite
depth.
· A slash followed by two consecutive asterisks then a slash
matches zero or more directories. For example, "aa//****//bb"
matches "aa//bb", "aa//xx//bb", "aa//xx//yy//bb" and so on.
· Other consecutive asterisks are considered invalid.
Glob magic is incompatible with literal magic.
attr
After aattttrr:: comes a space separated list of "attribute
requirements", all of which must be met in order for the path
to be considered a match; this is in addition to the usual
non-magic pathspec pattern matching. See ggiittaattttrriibbuutteess(5).
Each of the attribute requirements for the path takes one of
these forms:
· "AATTTTRR" requires that the attribute AATTTTRR be set.
· "--AATTTTRR" requires that the attribute AATTTTRR be unset.
· "AATTTTRR==VVAALLUUEE" requires that the attribute AATTTTRR be set to the
string VVAALLUUEE.
· "!!AATTTTRR" requires that the attribute AATTTTRR be unspecified.
exclude
After a path matches any non-exclude pathspec, it will be run
through all exclude pathspec (magic signature: !! or its
synonym ^^). If it matches, the path is ignored. When there is
no non-exclude pathspec, the exclusion is applied to the result
set as if invoked without any pathspec.
parent
A commit object contains a (possibly empty) list of the logical
predecessor(s) in the line of development, i.e. its parents.
pickaxe
The term pickaxe refers to an option to the diffcore routines that
help select changes that add or delete a given text string. With
the ----ppiicckkaaxxee--aallll option, it can be used to view the full changeset
that introduced or removed, say, a particular line of text. See
ggiitt--ddiiffff(1).
plumbing
Cute name for core Git.
porcelain
Cute name for programs and program suites depending on core Git,
presenting a high level access to core Git. Porcelains expose more
of a SCM interface than the plumbing.
per-worktree ref
Refs that are per-worktree, rather than global. This is presently
only HEAD and any refs that start with rreeffss//bbiisseecctt//, but might
later include other unusual refs.
pseudoref
Pseudorefs are a class of files under $$GGIITT__DDIIRR which behave like
refs for the purposes of rev-parse, but which are treated specially
by git. Pseudorefs both have names that are all-caps, and always
start with a line consisting of a SHA-1 followed by whitespace. So,
HEAD is not a pseudoref, because it is sometimes a symbolic ref.
They might optionally contain some additional data. MMEERRGGEE__HHEEAADD and
CCHHEERRRRYY__PPIICCKK__HHEEAADD are examples. Unlike per-worktree refs, these
files cannot be symbolic refs, and never have reflogs. They also
cannot be updated through the normal ref update machinery. Instead,
they are updated by directly writing to the files. However, they
can be read as if they were refs, so ggiitt rreevv--ppaarrssee MMEERRGGEE__HHEEAADD will
work.
pull
Pulling a branch means to fetch it and merge it. See also ggiitt--
ppuullll(1).
push
Pushing a branch means to get the branch’s head ref from a remote
repository, find out if it is a direct ancestor to the branch’s
local head ref, and in that case, putting all objects, which are
reachable from the local head ref, and which are missing from the
remote repository, into the remote object database, and updating
the remote head ref. If the remote head is not an ancestor to the
local head, the push fails.
reachable
All of the ancestors of a given commit are said to be "reachable"
from that commit. More generally, one object is reachable from
another if we can reach the one from the other by a chain that
follows tags to whatever they tag, commits to their parents or
trees, and trees to the trees or blobs that they contain.
rebase
To reapply a series of changes from a branch to a different base,
and reset the head of that branch to the result.
ref
A name that begins with rreeffss// (e.g. rreeffss//hheeaaddss//mmaasstteerr) that points
to an object name or another ref (the latter is called a symbolic
ref). For convenience, a ref can sometimes be abbreviated when used
as an argument to a Git command; see ggiittrreevviissiioonnss(7) for details.
Refs are stored in the repository.
The ref namespace is hierarchical. Different subhierarchies are
used for different purposes (e.g. the rreeffss//hheeaaddss// hierarchy is used
to represent local branches).
There are a few special-purpose refs that do not begin with rreeffss//.
The most notable example is HHEEAADD.
reflog
A reflog shows the local "history" of a ref. In other words, it can
tell you what the 3rd last revision in _t_h_i_s repository was, and
what was the current state in _t_h_i_s repository, yesterday 9:14pm.
See ggiitt--rreefflloogg(1) for details.
refspec
A "refspec" is used by fetch and push to describe the mapping
between remote ref and local ref.
remote repository
A repository which is used to track the same project but resides
somewhere else. To communicate with remotes, see fetch or push.
remote-tracking branch
A ref that is used to follow changes from another repository. It
typically looks like _r_e_f_s_/_r_e_m_o_t_e_s_/_f_o_o_/_b_a_r (indicating that it
tracks a branch named _b_a_r in a remote named _f_o_o), and matches the
right-hand-side of a configured fetch refspec. A remote-tracking
branch should not contain direct modifications or have local
commits made to it.
repository
A collection of refs together with an object database containing
all objects which are reachable from the refs, possibly accompanied
by meta data from one or more porcelains. A repository can share an
object database with other repositories via alternates mechanism.
resolve
The action of fixing up manually what a failed automatic merge left
behind.
revision
Synonym for commit (the noun).
rewind
To throw away part of the development, i.e. to assign the head to
an earlier revision.
SCM
Source code management (tool).
SHA-1
"Secure Hash Algorithm 1"; a cryptographic hash function. In the
context of Git used as a synonym for object name.
shallow clone
Mostly a synonym to shallow repository but the phrase makes it more
explicit that it was created by running ggiitt cclloonnee ----ddeepptthh==......
command.
shallow repository
A shallow repository has an incomplete history some of whose
commits have parents cauterized away (in other words, Git is told
to pretend that these commits do not have the parents, even though
they are recorded in the commit object). This is sometimes useful
when you are interested only in the recent history of a project
even though the real history recorded in the upstream is much
larger. A shallow repository is created by giving the ----ddeepptthh
option to ggiitt--cclloonnee(1), and its history can be later deepened with
ggiitt--ffeettcchh(1).
submodule
A repository that holds the history of a separate project inside
another repository (the latter of which is called superproject).
superproject
A repository that references repositories of other projects in its
working tree as submodules. The superproject knows about the names
of (but does not hold copies of) commit objects of the contained
submodules.
symref
Symbolic reference: instead of containing the SHA-1 id itself, it
is of the format _r_e_f_: _r_e_f_s_/_s_o_m_e_/_t_h_i_n_g and when referenced, it
recursively dereferences to this reference. _H_E_A_D is a prime
example of a symref. Symbolic references are manipulated with the
ggiitt--ssyymmbboolliicc--rreeff(1) command.
tag
A ref under rreeffss//ttaaggss// namespace that points to an object of an
arbitrary type (typically a tag points to either a tag or a commit
object). In contrast to a head, a tag is not updated by the ccoommmmiitt
command. A Git tag has nothing to do with a Lisp tag (which would
be called an object type in Git’s context). A tag is most typically
used to mark a particular point in the commit ancestry chain.
tag object
An object containing a ref pointing to another object, which can
contain a message just like a commit object. It can also contain a
(PGP) signature, in which case it is called a "signed tag object".
topic branch
A regular Git branch that is used by a developer to identify a
conceptual line of development. Since branches are very easy and
inexpensive, it is often desirable to have several small branches
that each contain very well defined concepts or small incremental
yet related changes.
tree
Either a working tree, or a tree object together with the dependent
blob and tree objects (i.e. a stored representation of a working
tree).
tree object
An object containing a list of file names and modes along with refs
to the associated blob and/or tree objects. A tree is equivalent to
a directory.
tree-ish (also treeish)
A tree object or an object that can be recursively dereferenced to
a tree object. Dereferencing a commit object yields the tree object
corresponding to the revision's top directory. The following are
all tree-ishes: a commit-ish, a tree object, a tag object that
points to a tree object, a tag object that points to a tag object
that points to a tree object, etc.
unmerged index
An index which contains unmerged index entries.
unreachable object
An object which is not reachable from a branch, tag, or any other
reference.
upstream branch
The default branch that is merged into the branch in question (or
the branch in question is rebased onto). It is configured via
branch.<name>.remote and branch.<name>.merge. If the upstream
branch of _A is _o_r_i_g_i_n_/_B sometimes we say "_A is tracking _o_r_i_g_i_n_/_B".
working tree
The tree of actual checked out files. The working tree normally
contains the contents of the HEAD commit’s tree, plus any local
changes that you have made but not yet committed.
SSEEEE AALLSSOO
ggiittttuuttoorriiaall(7), ggiittttuuttoorriiaall--22(7), ggiittccvvss--mmiiggrraattiioonn(7), ggiitteevveerryyddaayy(7),
TThhee GGiitt UUsseerr’’ss MMaannuuaall[1]
GGIITT
Part of the ggiitt(1) suite
NNOOTTEESS
1. The Git User’s Manual
git-htmldocs/user-manual.html
Git 2.13.6 09/24/2017 GITGLOSSARY(7)