From: Junio C Hamano Date: Mon, 26 May 2008 01:16:14 +0000 (+0000) Subject: Autogenerated HTML docs for v1.5.6-rc0 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dfccbb0719b88f4df05bf718c6008166dbadea44;p=git.git Autogenerated HTML docs for v1.5.6-rc0 --- diff --git a/config.txt b/config.txt index 002a06689..c298dc21c 100644 --- a/config.txt +++ b/config.txt @@ -662,11 +662,24 @@ gitcvs.logfile:: Path to a log file where the CVS server interface well... logs various stuff. See linkgit:git-cvsserver[1]. +gitcvs.usecrlfattr + If true, the server will look up the `crlf` attribute for + files to determine the '-k' modes to use. If `crlf` is set, + the '-k' mode will be left blank, so cvs clients will + treat it as text. If `crlf` is explicitly unset, the file + will be set with '-kb' mode, which supresses any newline munging + the client might otherwise do. If `crlf` is not specified, + then 'gitcvs.allbinary' is used. See linkgit:gitattribute[5]. + gitcvs.allbinary:: - If true, all files are sent to the client in mode '-kb'. This - causes the client to treat all files as binary files which suppresses - any newline munging it otherwise might do. A work-around for the - fact that there is no way yet to set single files to mode '-kb'. + This is used if 'gitcvs.usecrlfattr' does not resolve + the correct '-kb' mode to use. If true, all + unresolved files are sent to the client in + mode '-kb'. 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 'core.autocrlf'. gitcvs.dbname:: Database used by git-cvsserver to cache revision information @@ -697,8 +710,9 @@ gitcvs.dbTableNamePrefix:: linkgit:git-cvsserver[1] for details). Any non-alphabetic characters will be replaced with underscores. -All gitcvs variables except for 'gitcvs.allbinary' can also be -specified as 'gitcvs..' (where 'access_method' +All gitcvs variables except for 'gitcvs.usecrlfattr' and +'gitcvs.allbinary' can also be specified as +'gitcvs..' (where 'access_method' is one of "ext" and "pserver") to make them apply only for the given access method. diff --git a/core-tutorial.html b/core-tutorial.html index 75db35a31..c18105825 100644 --- a/core-tutorial.html +++ b/core-tutorial.html @@ -266,7 +266,7 @@ div.exampleblock-content {

This tutorial explains how to use the "core" git programs 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 or +to start with gittutorial(7)[a tutorial introduction to git] or the git user manual.

However, an understanding of these low-level tools can be helpful if you want to understand git's internals.

@@ -1873,7 +1873,7 @@ Use git format-patch origin to prepare patches for e-mail suggested in the previous section may be new to you. You do not have to worry. git supports "shared public repository" style of cooperation you are probably more familiar with as well.

-

See git for CVS users for the details.

+

See gitcvs-migration(7)[git for CVS users] for the details.

Bundling your work together

@@ -1967,7 +1967,7 @@ to follow, not easier.

diff --git a/core-tutorial.txt b/core-tutorial.txt index 5a5531222..b50b5dd48 100644 --- a/core-tutorial.txt +++ b/core-tutorial.txt @@ -8,7 +8,7 @@ This tutorial explains how to use the "core" git programs 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 link:tutorial.html[a tutorial introduction to git] or +to start with linkgit:gittutorial[7][a tutorial introduction to git] or link:user-manual.html[the git user manual]. However, an understanding of these low-level tools can be helpful if @@ -1581,7 +1581,7 @@ suggested in the previous section may be new to you. You do not have to worry. git supports "shared public repository" style of cooperation you are probably more familiar with as well. -See link:cvs-migration.html[git for CVS users] for the details. +See linkgit:gitcvs-migration[7][git for CVS users] for the details. Bundling your work together --------------------------- diff --git a/diff-options.txt b/diff-options.txt index 13234fa28..859d67990 100644 --- a/diff-options.txt +++ b/diff-options.txt @@ -228,6 +228,9 @@ endif::git-format-patch[] --no-ext-diff:: Disallow external diff drivers. +--ignore-submodules:: + Ignore changes to submodules in the diff generation. + --src-prefix=:: Show the given source prefix instead of "a/". diff --git a/git-cat-file.html b/git-cat-file.html index 681b21c71..6b0614761 100644 --- a/git-cat-file.html +++ b/git-cat-file.html @@ -272,13 +272,16 @@ git-cat-file(1) Manual Page

SYNOPSIS

-

git-cat-file [-t | -s | -e | -p | <type>] <object>

+

git-cat-file [-t | -s | -e | -p | <type>] <object> +git-cat-file [--batch | --batch-check] < <list-of-objects>

DESCRIPTION

-

Provides content or type of objects in the repository. The type -is required unless -t or -p is used to find the object type, -or -s is used to find the object size.

+

In the first form, provides content or type of objects in the repository. The +type is required unless -t or -p is used to find the object type, or -s +is used to find the object size.

+

In the second form, a list of object (separated by LFs) is provided on stdin, +and the SHA1, type, and size of each object is printed on stdout.

OPTIONS

@@ -341,6 +344,24 @@ or -s is used to find the object size.

points at it.

+
+--batch +
+
+

+ Print the SHA1, type, size, and contents of each object provided on + stdin. May not be combined with any other options or arguments. +

+
+
+--batch-check +
+
+

+ Print the SHA1, type, and size of each object provided on stdin. May not be + combined with any other options or arguments. +

+

OUTPUT

@@ -349,8 +370,27 @@ or -s is used to find the object size.

If -s is specified, the size of the <object> in bytes.

If -e is specified, no output.

If -p is specified, the contents of <object> are pretty-printed.

-

Otherwise the raw (though uncompressed) contents of the <object> will -be returned.

+

If <type> is specified, the raw (though uncompressed) contents of the <object> +will be returned.

+

If --batch is specified, output of the following form is printed for each +object specified on stdin:

+
+
+
<sha1> SP <type> SP <size> LF
+<contents> LF
+
+

If --batch-check is specified, output of the following form is printed for +each object specified fon stdin:

+
+
+
<sha1> SP <type> SP <size> LF
+
+

For both --batch and --batch-check, output of the following form is printed +for each object specified on stdin that does not exist in the repository:

+
+
+
<object> SP missing LF
+

Author

@@ -366,7 +406,7 @@ be returned.

diff --git a/git-cat-file.txt b/git-cat-file.txt index df42cb10f..f6c394c48 100644 --- a/git-cat-file.txt +++ b/git-cat-file.txt @@ -9,12 +9,16 @@ git-cat-file - Provide content or type/size information for repository objects SYNOPSIS -------- 'git-cat-file' [-t | -s | -e | -p | ] +'git-cat-file' [--batch | --batch-check] < DESCRIPTION ----------- -Provides content or type of objects in the repository. The type -is required unless '-t' or '-p' is used to find the object type, -or '-s' is used to find the object size. +In the first form, provides content or type of objects in the repository. The +type is required unless '-t' or '-p' is used to find the object type, or '-s' +is used to find the object size. + +In the second form, a list of object (separated by LFs) is provided on stdin, +and the SHA1, type, and size of each object is printed on stdout. OPTIONS ------- @@ -46,6 +50,14 @@ OPTIONS or to ask for a "blob" with being a tag object that points at it. +--batch:: + Print the SHA1, type, size, and contents of each object provided on + stdin. May not be combined with any other options or arguments. + +--batch-check:: + Print the SHA1, type, and size of each object provided on stdin. May not be + combined with any other options or arguments. + OUTPUT ------ If '-t' is specified, one of the . @@ -56,9 +68,30 @@ If '-e' is specified, no output. If '-p' is specified, the contents of are pretty-printed. -Otherwise the raw (though uncompressed) contents of the will -be returned. +If is specified, the raw (though uncompressed) contents of the +will be returned. + +If '--batch' is specified, output of the following form is printed for each +object specified on stdin: + +------------ + SP SP LF + LF +------------ + +If '--batch-check' is specified, output of the following form is printed for +each object specified fon stdin: + +------------ + SP SP LF +------------ + +For both '--batch' and '--batch-check', output of the following form is printed +for each object specified on stdin that does not exist in the repository: +------------ + SP missing LF +------------ Author ------ diff --git a/git-config.html b/git-config.html index fd92c3f29..89a5c720c 100644 --- a/git-config.html +++ b/git-config.html @@ -1689,15 +1689,29 @@ gitcvs.logfile various stuff. See git-cvsserver(1).

+ +

gitcvs.usecrlfattr + If true, the server will look up the crlf attribute for + files to determine the -k modes to use. If crlf is set, + the -k mode will be left blank, so cvs clients will + treat it as text. If crlf is explicitly unset, the file + will be set with -kb mode, which supresses any newline munging + the client might otherwise do. If crlf is not specified, + then gitcvs.allbinary is used. See gitattribute(5).

+
gitcvs.allbinary

- If true, all files are sent to the client in mode -kb. This - causes the client to treat all files as binary files which suppresses - any newline munging it otherwise might do. A work-around for the - fact that there is no way yet to set single files to mode -kb. + This is used if gitcvs.usecrlfattr does not resolve + the correct -kb mode to use. If true, all + unresolved files are sent to the client in + mode -kb. 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 core.autocrlf.

@@ -1750,8 +1764,9 @@ gitcvs.dbTableNamePrefix

-

All gitcvs variables except for gitcvs.allbinary can also be -specified as gitcvs.<access_method>.<varname> (where access_method +

All gitcvs variables except for gitcvs.usecrlfattr and +gitcvs.allbinary can also be specified as +gitcvs.<access_method>.<varname> (where access_method is one of "ext" and "pserver") to make them apply only for the given access method.

@@ -2574,7 +2589,7 @@ web.browser diff --git a/git-cvsexportcommit.html b/git-cvsexportcommit.html index d1d10b92a..25fd0d051 100644 --- a/git-cvsexportcommit.html +++ b/git-cvsexportcommit.html @@ -272,7 +272,7 @@ git-cvsexportcommit(1) Manual Page

SYNOPSIS

-

git-cvsexportcommit [-h] [-u] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-w cvsworkdir] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID

+

git-cvsexportcommit [-h] [-u] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-w cvsworkdir] [-W] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID

DESCRIPTION

@@ -373,6 +373,16 @@ should the changeset be done against.

+-W +
+
+

+ Tell cvsexportcommit that the current working directory is not only + a Git checkout, but also the CVS checkout. Therefore, Git will + reset the working directory to the parent commit before proceeding. +

+
+
-v
@@ -446,7 +456,7 @@ $ git-cherry cvshead myhead | sed -n 's/^+ //p' | xargs -l1 git-cvsexportcommit
diff --git a/git-cvsexportcommit.txt b/git-cvsexportcommit.txt index 363c36d69..f75afaaad 100644 --- a/git-cvsexportcommit.txt +++ b/git-cvsexportcommit.txt @@ -8,7 +8,7 @@ git-cvsexportcommit - Export a single commit to a CVS checkout SYNOPSIS -------- -'git-cvsexportcommit' [-h] [-u] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-w cvsworkdir] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID +'git-cvsexportcommit' [-h] [-u] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-w cvsworkdir] [-W] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID DESCRIPTION @@ -68,6 +68,11 @@ OPTIONS current directory is within a git repository. The default is the value of 'cvsexportcommit.cvsdir'. +-W:: + Tell cvsexportcommit that the current working directory is not only + a Git checkout, but also the CVS checkout. Therefore, Git will + reset the working directory to the parent commit before proceeding. + -v:: Verbose. diff --git a/git-cvsserver.html b/git-cvsserver.html index ccb9def4c..71cd46303 100644 --- a/git-cvsserver.html +++ b/git-cvsserver.html @@ -671,11 +671,28 @@ TortoiseCVS checkout, diff, status, update, log, add, remove, commit. Legacy monitoring operations are not supported (edit, watch and related). Exports and tagging (tags and branches) are not supported at this stage.

-

The server should set the -k mode to binary when relevant, however, -this is not really implemented yet. For now, you can force the server -to set -kb for all files by setting the gitcvs.allbinary config -variable. In proper GIT tradition, the contents of the files are -always respected. No keyword expansion or newline munging is supported.

+

CRLF Line Ending Conversions

+

By default the server leaves the -k mode blank for all files, +which causes the cvs client to treat them as a text files, subject +to crlf conversion on some platforms.

+

You can make the server use crlf attributes to set the -k modes +for files by setting the gitcvs.usecrlfattr config variable. +In this case, if crlf is explicitly unset (-crlf), then the +server will set -kb mode for binary files. If crlf is set, +then the -k mode will explicitly be left blank. See +also gitattributes(5) for more information about the crlf +attribute.

+

Alternatively, if gitcvs.usecrlfattr config is not enabled +or if the crlf attribute is unspecified for a filename, then +the server uses the gitcvs.allbinary config for the default setting. +If gitcvs.allbinary is set, then file not otherwise +specified will default to -kb mode. Otherwise the -k mode +is left blank. But if gitcvs.allbinary is set to "guess", then +the correct -k mode will be guessed based on the contents of +the file.

+

For best consistency with cvs, it is probably best to override the +defaults by setting gitcvs.usecrlfattr to true, +and gitcvs.allbinary to "guess".

Dependencies

@@ -709,7 +726,7 @@ Martin Langhoff <martin@catalyst.net.nz>
diff --git a/git-cvsserver.txt b/git-cvsserver.txt index b1106714b..a33382ec2 100644 --- a/git-cvsserver.txt +++ b/git-cvsserver.txt @@ -301,11 +301,33 @@ checkout, diff, status, update, log, add, remove, commit. Legacy monitoring operations are not supported (edit, watch and related). Exports and tagging (tags and branches) are not supported at this stage. -The server should set the '-k' mode to binary when relevant, however, -this is not really implemented yet. For now, you can force the server -to set '-kb' for all files by setting the `gitcvs.allbinary` config -variable. In proper GIT tradition, the contents of the files are -always respected. No keyword expansion or newline munging is supported. +CRLF Line Ending Conversions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +By default the server leaves the '-k' mode blank for all files, +which causes the cvs client to treat them as a text files, subject +to crlf conversion on some platforms. + +You can make the server use `crlf` attributes to set the '-k' modes +for files by setting the `gitcvs.usecrlfattr` config variable. +In this case, if `crlf` is explicitly unset ('-crlf'), then the +server will set '-kb' mode for binary files. If `crlf` is set, +then the '-k' mode will explicitly be left blank. See +also linkgit:gitattributes[5] for more information about the `crlf` +attribute. + +Alternatively, if `gitcvs.usecrlfattr` config is not enabled +or if the `crlf` attribute is unspecified for a filename, then +the server uses the `gitcvs.allbinary` config for the default setting. +If `gitcvs.allbinary` is set, then file not otherwise +specified will default to '-kb' mode. Otherwise the '-k' mode +is left blank. But if `gitcvs.allbinary` is set to "guess", then +the correct '-k' mode will be guessed based on the contents of +the file. + +For best consistency with cvs, it is probably best to override the +defaults by setting `gitcvs.usecrlfattr` to true, +and `gitcvs.allbinary` to "guess". Dependencies ------------ diff --git a/git-diff-files.html b/git-diff-files.html index 6d1789343..f749733f9 100644 --- a/git-diff-files.html +++ b/git-diff-files.html @@ -724,6 +724,14 @@ same as "git-diff-index" and "git-diff-tree".

+--ignore-submodules +
+
+

+ Ignore changes to submodules in the diff generation. +

+
+
--src-prefix=<prefix>
@@ -1288,7 +1296,7 @@ the pathname, but if that is NUL, the record will show two paths.

diff --git a/git-diff-index.html b/git-diff-index.html index 3882f412a..1f62adbb0 100644 --- a/git-diff-index.html +++ b/git-diff-index.html @@ -725,6 +725,14 @@ entries in the index are compared.

+--ignore-submodules +
+
+

+ Ignore changes to submodules in the diff generation. +

+
+
--src-prefix=<prefix>
@@ -1370,7 +1378,7 @@ always have the special all-zero sha1. diff --git a/git-diff-tree.html b/git-diff-tree.html index b9d1dcff0..08baf7fde 100644 --- a/git-diff-tree.html +++ b/git-diff-tree.html @@ -727,6 +727,14 @@ git-diff-tree(1) Manual Page

+--ignore-submodules +
+
+

+ Ignore changes to submodules in the diff generation. +

+
+
--src-prefix=<prefix>
@@ -1765,7 +1773,7 @@ the pathname, but if that is NUL, the record will show two paths.

diff --git a/git-diff.html b/git-diff.html index f41c9a683..584b8f7ec 100644 --- a/git-diff.html +++ b/git-diff.html @@ -803,6 +803,14 @@ and the range notations ("<commit>..<commit>" and

+--ignore-submodules +
+
+

+ Ignore changes to submodules in the diff generation. +

+
+
--src-prefix=<prefix>
@@ -1485,7 +1493,7 @@ Output diff in reverse. diff --git a/git-format-patch.html b/git-format-patch.html index 53b50d532..d60ed59ad 100644 --- a/git-format-patch.html +++ b/git-format-patch.html @@ -773,6 +773,14 @@ reference.

+--ignore-submodules +
+
+

+ Ignore changes to submodules in the diff generation. +

+
+
--src-prefix=<prefix>
@@ -1080,7 +1088,7 @@ as e-mailable patches: diff --git a/git-hash-object.html b/git-hash-object.html index 1281beefb..1ccac91f5 100644 --- a/git-hash-object.html +++ b/git-hash-object.html @@ -272,7 +272,7 @@ git-hash-object(1) Manual Page

SYNOPSIS

-

git-hash-object [-t <type>] [-w] [--stdin] [--] <file>…

+

git-hash-object [-t <type>] [-w] [--stdin | --stdin-paths] [--] <file>…

DESCRIPTION

@@ -311,6 +311,14 @@ specified, it defaults to "blob".

Read the object from standard input instead of from a file.

+
+--stdin-paths +
+
+

+ Read file names from stdin instead of from the command-line. +

+

Author

@@ -327,7 +335,7 @@ specified, it defaults to "blob".

diff --git a/git-hash-object.txt b/git-hash-object.txt index 33030c022..99a21434b 100644 --- a/git-hash-object.txt +++ b/git-hash-object.txt @@ -8,7 +8,7 @@ git-hash-object - Compute object ID and optionally creates a blob from a file SYNOPSIS -------- -'git-hash-object' [-t ] [-w] [--stdin] [--] ... +'git-hash-object' [-t ] [-w] [--stdin | --stdin-paths] [--] ... DESCRIPTION ----------- @@ -32,6 +32,9 @@ OPTIONS --stdin:: Read the object from standard input instead of from a file. +--stdin-paths:: + Read file names from stdin instead of from the command-line. + Author ------ Written by Junio C Hamano diff --git a/git-log.html b/git-log.html index 753c77bc6..3c4658d4d 100644 --- a/git-log.html +++ b/git-log.html @@ -725,6 +725,14 @@ each commit introduces are shown.

+--ignore-submodules +
+
+

+ Ignore changes to submodules in the diff generation. +

+
+
--src-prefix=<prefix>
@@ -1943,7 +1951,7 @@ reversible operation.

diff --git a/git-svn.html b/git-svn.html index 6cebaf7ee..71edb35ec 100644 --- a/git-svn.html +++ b/git-svn.html @@ -373,6 +373,28 @@ branches, tags directories).

+--use-log-author +
+
+

+ When retrieving svn commits into git (as part of fetch, rebase, or + dcommit operations), look for the first From: or Signed-off-by: line + in the log message and use that as the author string. +

+
+
+--add-author-from +
+
+

+ When committing to svn from git (as part of commit or dcommit + operations), if the existing log message doesn't already have a + From: or Signed-off-by: line, append a From: line based on the + git commit's author string. If you use this, then --use-log-author + will retrieve a valid author string for all commits. +

+
+
--username=<USER>
@@ -1149,7 +1171,7 @@ should be manually entered with a text-editor or using diff --git a/git-svn.txt b/git-svn.txt index 3eae1ebb7..c9e4efe7f 100644 --- a/git-svn.txt +++ b/git-svn.txt @@ -61,6 +61,16 @@ COMMANDS Set the 'useSvnsyncProps' option in the [svn-remote] config. --rewrite-root=;; Set the 'rewriteRoot' option in the [svn-remote] config. +--use-log-author;; + When retrieving svn commits into git (as part of fetch, rebase, or + dcommit operations), look for the first From: or Signed-off-by: line + in the log message and use that as the author string. +--add-author-from;; + When committing to svn from git (as part of commit or dcommit + operations), if the existing log message doesn't already have a + From: or Signed-off-by: line, append a From: line based on the + git commit's author string. If you use this, then --use-log-author + will retrieve a valid author string for all commits. --username=;; For transports that SVN handles authentication for (http, https, and plain svn), specify the username. For other diff --git a/git-update-index.html b/git-update-index.html index 2038b4900..2365540af 100644 --- a/git-update-index.html +++ b/git-update-index.html @@ -279,6 +279,7 @@ git-update-index(1) Manual Page [--cacheinfo <mode> <object> <file>]* [--chmod=(+|-)x] [--assume-unchanged | --no-assume-unchanged] + [--ignore-submodules] [--really-refresh] [--unresolve] [--again | -g] [--info-only] [--index-info] [-z] [--stdin] @@ -337,6 +338,11 @@ using the various options:

git-update-index continue anyway.

+ +

--ignore-submodules: + Do not try to update submodules. This option is only respected + when passed before --refresh.

+
--unmerged
@@ -721,7 +727,7 @@ from symbolic link to regular file.

diff --git a/git-update-index.txt b/git-update-index.txt index 66be18ef3..06640603c 100644 --- a/git-update-index.txt +++ b/git-update-index.txt @@ -15,6 +15,7 @@ SYNOPSIS [--cacheinfo ]\* [--chmod=(+|-)x] [--assume-unchanged | --no-assume-unchanged] + [--ignore-submodules] [--really-refresh] [--unresolve] [--again | -g] [--info-only] [--index-info] [-z] [--stdin] @@ -54,6 +55,10 @@ OPTIONS default behavior is to error out. This option makes git-update-index continue anyway. +--ignore-submodules: + Do not try to update submodules. This option is only respected + when passed before --refresh. + --unmerged:: If --refresh finds unmerged changes in the index, the default behavior is to error out. This option makes git-update-index diff --git a/git.html b/git.html index ea7673a37..1eccafe4a 100644 --- a/git.html +++ b/git.html @@ -283,10 +283,10 @@ git(7) Manual Page

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

-

See this tutorial to get started, then see +

See this gittutorial(7)[tutorial] to get started, then see Everyday Git for a useful minimum set of commands, and "man git-commandname" for documentation of each command. CVS users may -also want to read CVS migration. See +also want to read gitcvs-migration(7)[CVS migration]. See Git User's Manual for a more in-depth introduction.

The COMMAND is either a name of a Git command (see below) or an alias @@ -1952,7 +1952,7 @@ contributors on the git-list <git@vger.kernel.org>.

diff --git a/git.txt b/git.txt index adcd3e00b..735f0d19c 100644 --- a/git.txt +++ b/git.txt @@ -20,10 +20,10 @@ Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. -See this link:tutorial.html[tutorial] to get started, then see +See this linkgit:gittutorial[7][tutorial] to get started, then see link:everyday.html[Everyday Git] for a useful minimum set of commands, and "man git-commandname" for documentation of each command. CVS users may -also want to read link:cvs-migration.html[CVS migration]. See +also want to read linkgit:gitcvs-migration[7][CVS migration]. See link:user-manual.html[Git User's Manual] for a more in-depth introduction. diff --git a/gitcvs-migration.html b/gitcvs-migration.html new file mode 100644 index 000000000..68f5a1bf5 --- /dev/null +++ b/gitcvs-migration.html @@ -0,0 +1,446 @@ + + + + + + +gitcvs-migration(7) + + + +

SYNOPSIS

+
+

git cvsimport *

+
+

DESCRIPTION

+
+

Git differs from CVS in that every working tree contains a repository with +a full copy of the project history, and no repository is inherently more +important than any other. However, you can emulate the CVS model by +designating a single shared repository which people can synchronize with; +this document explains how to do that.

+

Some basic familiarity with git is required. This +gittutorial(7)[tutorial introduction to git] and the +git glossary should be sufficient.

+
+

Developing against a shared repository

+
+

Suppose a shared repository is set up in /pub/repo.git on the host +foo.com. Then as an individual committer you can clone the shared +repository over ssh with:

+
+
+
$ git clone foo.com:/pub/repo.git/ my-project
+$ cd my-project
+
+

and hack away. The equivalent of cvs update is

+
+
+
$ git pull origin
+
+

which merges in any work that others might have done since the clone +operation. If there are uncommitted changes in your working tree, commit +them first before running git pull.

+
+ + + +
+
Note
+
+

The pull command knows where to get updates from because of certain +configuration variables that were set by the first git clone +command; see git config -l and the git-config(1) man +page for details.

+
+
+

You can update the shared repository with your changes by first committing +your changes, and then using the git-push(1) command:

+
+
+
$ git push origin master
+
+

to "push" those commits to the shared repository. If someone else has +updated the repository more recently, git push, like cvs commit, will +complain, in which case you must pull any changes before attempting the +push again.

+

In the git push command above we specify the name of the remote branch +to update (master). If we leave that out, git push tries to update +any branches in the remote repository that have the same name as a branch +in the local repository. So the last push can be done with either of:

+
+
+
$ git push origin
+$ git push foo.com:/pub/project.git/
+
+

as long as the shared repository does not have any branches +other than master.

+
+

Setting Up a Shared Repository

+
+

We assume you have already created a git repository for your project, +possibly created from scratch or from a tarball (see the +gittutorial(7)[tutorial]), or imported from an already existing CVS +repository (see the next section).

+

Assume your existing repo is at /home/alice/myproject. Create a new "bare" +repository (a repository without a working tree) and fetch your project into +it:

+
+
+
$ mkdir /pub/my-repo.git
+$ cd /pub/my-repo.git
+$ git --bare init --shared
+$ git --bare fetch /home/alice/myproject master:master
+
+

Next, give every team member read/write access to this repository. One +easy way to do this is to give all the team members ssh access to the +machine where the repository is hosted. If you don't want to give them a +full shell on the machine, there is a restricted shell which only allows +users to do git pushes and pulls; see git-shell(1).

+

Put all the committers in the same group, and make the repository +writable by that group:

+
+
+
$ chgrp -R $group /pub/my-repo.git
+
+

Make sure committers have a umask of at most 027, so that the directories +they create are writable and searchable by other group members.

+
+

Importing a CVS archive

+
+

First, install version 2.1 or higher of cvsps from +http://www.cobite.com/cvsps/ and make +sure it is in your path. Then cd to a checked out CVS working directory +of the project you are interested in and run git-cvsimport(1):

+
+
+
$ git cvsimport -C <destination> <module>
+
+

This puts a git archive of the named CVS module in the directory +<destination>, which will be created if necessary.

+

The import checks out from CVS every revision of every file. Reportedly +cvsimport can average some twenty revisions per second, so for a +medium-sized project this should not take more than a couple of minutes. +Larger projects or remote repositories may take longer.

+

The main trunk is stored in the git branch named origin, and additional +CVS branches are stored in git branches with the same names. The most +recent version of the main trunk is also left checked out on the master +branch, so you can start adding your own changes right away.

+

The import is incremental, so if you call it again next month it will +fetch any CVS updates that have been made in the meantime. For this to +work, you must not modify the imported branches; instead, create new +branches for your own changes, and merge in the imported branches as +necessary.

+
+

Advanced Shared Repository Management

+
+

Git allows you to specify scripts called "hooks" to be run at certain +points. You can use these, for example, to send all commits to the shared +repository to a mailing list. See githooks(5)[Hooks used by git].

+

You can enforce finer grained permissions using update hooks. See +Controlling access to branches using +update hooks.

+
+

Providing CVS Access to a git Repository

+
+

It is also possible to provide true CVS access to a git repository, so +that developers can still use CVS; see git-cvsserver(1) for +details.

+
+

Alternative Development Models

+
+

CVS users are accustomed to giving a group of developers commit access to +a common repository. As we've seen, this is also possible with git. +However, the distributed nature of git allows other development models, +and you may want to first consider whether one of them might be a better +fit for your project.

+

For example, you can choose a single person to maintain the project's +primary public repository. Other developers then clone this repository +and each work in their own clone. When they have a series of changes that +they're happy with, they ask the maintainer to pull from the branch +containing the changes. The maintainer reviews their changes and pulls +them into the primary repository, which other developers pull from as +necessary to stay coordinated. The Linux kernel and other projects use +variants of this model.

+

With a small group, developers may just pull changes from each other's +repositories without the need for a central maintainer.

+
+

SEE ALSO

+ +

GIT

+
+

Part of the git(7) suite.

+
+ + + diff --git a/cvs-migration.txt b/gitcvs-migration.txt similarity index 93% rename from cvs-migration.txt rename to gitcvs-migration.txt index 374bc87b1..c41080502 100644 --- a/cvs-migration.txt +++ b/gitcvs-migration.txt @@ -1,5 +1,16 @@ -git for CVS users -================= +gitcvs-migration(7) +=================== + +NAME +---- +gitcvs-migration - git for CVS users + +SYNOPSIS +-------- +git cvsimport * + +DESCRIPTION +----------- Git differs from CVS in that every working tree contains a repository with a full copy of the project history, and no repository is inherently more @@ -8,7 +19,7 @@ designating a single shared repository which people can synchronize with; this document explains how to do that. Some basic familiarity with git is required. This -link:tutorial.html[tutorial introduction to git] and the +linkgit:gittutorial[7][tutorial introduction to git] and the link:glossary.html[git glossary] should be sufficient. Developing against a shared repository @@ -71,7 +82,7 @@ Setting Up a Shared Repository We assume you have already created a git repository for your project, possibly created from scratch or from a tarball (see the -link:tutorial.html[tutorial]), or imported from an already existing CVS +linkgit:gittutorial[7][tutorial]), or imported from an already existing CVS repository (see the next section). Assume your existing repo is at /home/alice/myproject. Create a new "bare" @@ -170,3 +181,13 @@ variants of this model. With a small group, developers may just pull changes from each other's repositories without the need for a central maintainer. + +SEE ALSO +-------- +linkgit:gittutorial[7], linkgit:gittutorial-2[7], +link:everyday.html[Everyday Git], +link:user-manual.html[The Git User's Manual] + +GIT +--- +Part of the linkgit:git[7] suite. diff --git a/gittutorial-2.html b/gittutorial-2.html new file mode 100644 index 000000000..1f29a67e2 --- /dev/null +++ b/gittutorial-2.html @@ -0,0 +1,677 @@ + + + + + + +gittutorial-2(7) + + + +

SYNOPSIS

+
+

git *

+
+

DESCRIPTION

+
+

You should work through gittutorial(7)[A tutorial introduction to +git] before reading this tutorial.

+

The goal of this tutorial is to introduce two fundamental pieces of +git's architecture--the object database and the index file--and to +provide the reader with everything necessary to understand the rest +of the git documentation.

+
+

The git object database

+
+

Let's start a new project and create a small amount of history:

+
+
+
$ mkdir test-project
+$ cd test-project
+$ git init
+Initialized empty Git repository in .git/
+$ echo 'hello world' > file.txt
+$ git add .
+$ git commit -a -m "initial commit"
+Created initial commit 54196cc2703dc165cbd373a65a4dcf22d50ae7f7
+ create mode 100644 file.txt
+$ echo 'hello world!' >file.txt
+$ git commit -a -m "add emphasis"
+Created commit c4d59f390b9cfd4318117afde11d601c1085f241
+
+

What are the 40 digits of hex that git responded to the commit with?

+

We saw in part one of the tutorial that commits have names like this. +It turns out that every object in the git history is stored under +such a 40-digit hex name. That name is the SHA1 hash of the object's +contents; among other things, this ensures that git will never store +the same data twice (since identical data is given an identical SHA1 +name), and that the contents of a git object will never change (since +that would change the object's name as well).

+

It is expected that the content of the commit object you created while +following the example above generates a different SHA1 hash than +the one shown above because the commit object records the time when +it was created and the name of the person performing the commit.

+

We can ask git about this particular object with the cat-file +command. Don't copy the 40 hex digits from this example but use those +from your own version. Note that you can shorten it to only a few +characters to save yourself typing all 40 hex digits:

+
+
+
$ git-cat-file -t 54196cc2
+commit
+$ git-cat-file commit 54196cc2
+tree 92b8b694ffb1675e5975148e1121810081dbdffe
+author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500
+committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500
+
+initial commit
+
+

A tree can refer to one or more "blob" objects, each corresponding to +a file. In addition, a tree can also refer to other tree objects, +thus creating a directory hierarchy. You can examine the contents of +any tree using ls-tree (remember that a long enough initial portion +of the SHA1 will also work):

+
+
+
$ git ls-tree 92b8b694
+100644 blob 3b18e512dba79e4c8300dd08aeb37f8e728b8dad    file.txt
+
+

Thus we see that this tree has one file in it. The SHA1 hash is a +reference to that file's data:

+
+
+
$ git cat-file -t 3b18e512
+blob
+
+

A "blob" is just file data, which we can also examine with cat-file:

+
+
+
$ git cat-file blob 3b18e512
+hello world
+
+

Note that this is the old file data; so the object that git named in +its response to the initial tree was a tree with a snapshot of the +directory state that was recorded by the first commit.

+

All of these objects are stored under their SHA1 names inside the git +directory:

+
+
+
$ find .git/objects/
+.git/objects/
+.git/objects/pack
+.git/objects/info
+.git/objects/3b
+.git/objects/3b/18e512dba79e4c8300dd08aeb37f8e728b8dad
+.git/objects/92
+.git/objects/92/b8b694ffb1675e5975148e1121810081dbdffe
+.git/objects/54
+.git/objects/54/196cc2703dc165cbd373a65a4dcf22d50ae7f7
+.git/objects/a0
+.git/objects/a0/423896973644771497bdc03eb99d5281615b51
+.git/objects/d0
+.git/objects/d0/492b368b66bdabf2ac1fd8c92b39d3db916e59
+.git/objects/c4
+.git/objects/c4/d59f390b9cfd4318117afde11d601c1085f241
+
+

and the contents of these files is just the compressed data plus a +header identifying their length and their type. The type is either a +blob, a tree, a commit, or a tag.

+

The simplest commit to find is the HEAD commit, which we can find +from .git/HEAD:

+
+
+
$ cat .git/HEAD
+ref: refs/heads/master
+
+

As you can see, this tells us which branch we're currently on, and it +tells us this by naming a file under the .git directory, which itself +contains a SHA1 name referring to a commit object, which we can +examine with cat-file:

+
+
+
$ cat .git/refs/heads/master
+c4d59f390b9cfd4318117afde11d601c1085f241
+$ git cat-file -t c4d59f39
+commit
+$ git cat-file commit c4d59f39
+tree d0492b368b66bdabf2ac1fd8c92b39d3db916e59
+parent 54196cc2703dc165cbd373a65a4dcf22d50ae7f7
+author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143418702 -0500
+committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143418702 -0500
+
+add emphasis
+
+

The "tree" object here refers to the new state of the tree:

+
+
+
$ git ls-tree d0492b36
+100644 blob a0423896973644771497bdc03eb99d5281615b51    file.txt
+$ git cat-file blob a0423896
+hello world!
+
+

and the "parent" object refers to the previous commit:

+
+
+
$ git-cat-file commit 54196cc2
+tree 92b8b694ffb1675e5975148e1121810081dbdffe
+author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500
+committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500
+
+initial commit
+
+

The tree object is the tree we examined first, and this commit is +unusual in that it lacks any parent.

+

Most commits have only one parent, but it is also common for a commit +to have multiple parents. In that case the commit represents a +merge, with the parent references pointing to the heads of the merged +branches.

+

Besides blobs, trees, and commits, the only remaining type of object +is a "tag", which we won't discuss here; refer to git-tag(1) +for details.

+

So now we know how git uses the object database to represent a +project's history:

+
    +
  • +

    +"commit" objects refer to "tree" objects representing the + snapshot of a directory tree at a particular point in the + history, and refer to "parent" commits to show how they're + connected into the project history. +

    +
  • +
  • +

    +"tree" objects represent the state of a single directory, + associating directory names to "blob" objects containing file + data and "tree" objects containing subdirectory information. +

    +
  • +
  • +

    +"blob" objects contain file data without any other structure. +

    +
  • +
  • +

    +References to commit objects at the head of each branch are + stored in files under .git/refs/heads/. +

    +
  • +
  • +

    +The name of the current branch is stored in .git/HEAD. +

    +
  • +
+

Note, by the way, that lots of commands take a tree as an argument. +But as we can see above, a tree can be referred to in many different +ways--by the SHA1 name for that tree, by the name of a commit that +refers to the tree, by the name of a branch whose head refers to that +tree, etc.--and most such commands can accept any of these names.

+

In command synopses, the word "tree-ish" is sometimes used to +designate such an argument.

+
+

The index file

+
+

The primary tool we've been using to create commits is "git commit +-a", which creates a commit including every change you've made to +your working tree. But what if you want to commit changes only to +certain files? Or only certain changes to certain files?

+

If we look at the way commits are created under the cover, we'll see +that there are more flexible ways creating commits.

+

Continuing with our test-project, let's modify file.txt again:

+
+
+
$ echo "hello world, again" >>file.txt
+
+

but this time instead of immediately making the commit, let's take an +intermediate step, and ask for diffs along the way to keep track of +what's happening:

+
+
+
$ git diff
+--- a/file.txt
++++ b/file.txt
+@@ -1 +1,2 @@
+ hello world!
++hello world, again
+$ git add file.txt
+$ git diff
+
+

The last diff is empty, but no new commits have been made, and the +head still doesn't contain the new line:

+
+
+
$ git-diff HEAD
+diff --git a/file.txt b/file.txt
+index a042389..513feba 100644
+--- a/file.txt
++++ b/file.txt
+@@ -1 +1,2 @@
+ hello world!
++hello world, again
+
+

So "git diff" is comparing against something other than the head. +The thing that it's comparing against is actually the index file, +which is stored in .git/index in a binary format, but whose contents +we can examine with ls-files:

+
+
+
$ git ls-files --stage
+100644 513feba2e53ebbd2532419ded848ba19de88ba00 0       file.txt
+$ git cat-file -t 513feba2
+blob
+$ git cat-file blob 513feba2
+hello world!
+hello world, again
+
+

So what our "git add" did was store a new blob and then put +a reference to it in the index file. If we modify the file again, +we'll see that the new modifications are reflected in the "git-diff" +output:

+
+
+
$ echo 'again?' >>file.txt
+$ git diff
+index 513feba..ba3da7b 100644
+--- a/file.txt
++++ b/file.txt
+@@ -1,2 +1,3 @@
+ hello world!
+ hello world, again
++again?
+
+

With the right arguments, git diff can also show us the difference +between the working directory and the last commit, or between the +index and the last commit:

+
+
+
$ git diff HEAD
+diff --git a/file.txt b/file.txt
+index a042389..ba3da7b 100644
+--- a/file.txt
++++ b/file.txt
+@@ -1 +1,3 @@
+ hello world!
++hello world, again
++again?
+$ git diff --cached
+diff --git a/file.txt b/file.txt
+index a042389..513feba 100644
+--- a/file.txt
++++ b/file.txt
+@@ -1 +1,2 @@
+ hello world!
++hello world, again
+
+

At any time, we can create a new commit using "git commit" (without +the -a option), and verify that the state committed only includes the +changes stored in the index file, not the additional change that is +still only in our working tree:

+
+
+
$ git commit -m "repeat"
+$ git diff HEAD
+diff --git a/file.txt b/file.txt
+index 513feba..ba3da7b 100644
+--- a/file.txt
++++ b/file.txt
+@@ -1,2 +1,3 @@
+ hello world!
+ hello world, again
++again?
+
+

So by default "git commit" uses the index to create the commit, not +the working tree; the -a option to commit tells it to first update +the index with all changes in the working tree.

+

Finally, it's worth looking at the effect of "git add" on the index +file:

+
+
+
$ echo "goodbye, world" >closing.txt
+$ git add closing.txt
+
+

The effect of the "git add" was to add one entry to the index file:

+
+
+
$ git ls-files --stage
+100644 8b9743b20d4b15be3955fc8d5cd2b09cd2336138 0       closing.txt
+100644 513feba2e53ebbd2532419ded848ba19de88ba00 0       file.txt
+
+

And, as you can see with cat-file, this new entry refers to the +current contents of the file:

+
+
+
$ git cat-file blob 8b9743b2
+goodbye, world
+
+

The "status" command is a useful way to get a quick summary of the +situation:

+
+
+
$ git status
+# On branch master
+# Changes to be committed:
+#   (use "git reset HEAD <file>..." to unstage)
+#
+#       new file: closing.txt
+#
+# Changed but not updated:
+#   (use "git add <file>..." to update what will be committed)
+#
+#       modified: file.txt
+#
+
+

Since the current state of closing.txt is cached in the index file, +it is listed as "Changes to be committed". Since file.txt has +changes in the working directory that aren't reflected in the index, +it is marked "changed but not updated". At this point, running "git +commit" would create a commit that added closing.txt (with its new +contents), but that didn't modify file.txt.

+

Also, note that a bare "git diff" shows the changes to file.txt, but +not the addition of closing.txt, because the version of closing.txt +in the index file is identical to the one in the working directory.

+

In addition to being the staging area for new commits, the index file +is also populated from the object database when checking out a +branch, and is used to hold the trees involved in a merge operation. +See the core tutorial and the relevant man +pages for details.

+
+

What next?

+
+

At this point you should know everything necessary to read the man +pages for any of the git commands; one good place to start would be +with the commands mentioned in Everyday git. You +should be able to find any unknown jargon in the +Glossary.

+

The Git User's Manual provides a more +comprehensive introduction to git.

+

The gitcvs-migration(7)[CVS migration] document explains how to +import a CVS repository into git, and shows how to use git in a +CVS-like way.

+

For some interesting examples of git use, see the +howtos.

+

For git developers, the Core tutorial goes +into detail on the lower-level git mechanisms involved in, for +example, creating a new commit.

+
+

SEE ALSO

+ +

GIT

+
+

Part of the git(7) suite.

+
+ + + diff --git a/tutorial-2.txt b/gittutorial-2.txt similarity index 96% rename from tutorial-2.txt rename to gittutorial-2.txt index 7fac47de8..5bbbf4305 100644 --- a/tutorial-2.txt +++ b/gittutorial-2.txt @@ -1,7 +1,18 @@ -A tutorial introduction to git: part two -======================================== +gittutorial-2(7) +================ -You should work through link:tutorial.html[A tutorial introduction to +NAME +---- +gittutorial-2 - A tutorial introduction to git: part two + +SYNOPSIS +-------- +git * + +DESCRIPTION +----------- + +You should work through linkgit:gittutorial[7][A tutorial introduction to git] before reading this tutorial. The goal of this tutorial is to introduce two fundamental pieces of @@ -394,7 +405,7 @@ link:glossary.html[Glossary]. The link:user-manual.html[Git User's Manual] provides a more comprehensive introduction to git. -The link:cvs-migration.html[CVS migration] document explains how to +The linkgit:gitcvs-migration[7][CVS migration] document explains how to import a CVS repository into git, and shows how to use git in a CVS-like way. @@ -404,3 +415,14 @@ link:howto-index.html[howtos]. For git developers, the link:core-tutorial.html[Core tutorial] goes into detail on the lower-level git mechanisms involved in, for example, creating a new commit. + +SEE ALSO +-------- +linkgit:gittutorial[7], +linkgit:gitcvs-migration[7], +link:everyday.html[Everyday git], +link:user-manual.html[The Git User's Manual] + +GIT +--- +Part of the linkgit:git[7] suite. diff --git a/gittutorial.html b/gittutorial.html new file mode 100644 index 000000000..e531d4704 --- /dev/null +++ b/gittutorial.html @@ -0,0 +1,816 @@ + + + + + + +gittutorial(7) + + + +

SYNOPSIS

+
+

git *

+
+

DESCRIPTION

+
+

This tutorial explains how to import a new project into git, make +changes to it, and share changes with other developers.

+

If you are instead primarily interested in using git to fetch a project, +for example, to test the latest version, you may prefer to start with +the first two chapters of The Git User's Manual.

+

First, note that you can get documentation for a command such as "git +diff" with:

+
+
+
$ man git-diff
+
+

It is a good idea to introduce yourself to git with your name and +public email address before doing any operation. The easiest +way to do so is:

+
+
+
$ git config --global user.name "Your Name Comes Here"
+$ git config --global user.email you@yourdomain.example.com
+
+
+

Importing a new project

+
+

Assume you have a tarball project.tar.gz with your initial work. You +can place it under git revision control as follows.

+
+
+
$ tar xzf project.tar.gz
+$ cd project
+$ git init
+
+

Git will reply

+
+
+
Initialized empty Git repository in .git/
+
+

You've now initialized the working directory--you may notice a new +directory created, named ".git".

+

Next, tell git to take a snapshot of the contents of all files under the +current directory (note the .), with git-add(1):

+
+
+
$ git add .
+
+

This snapshot is now stored in a temporary staging area which git calls +the "index". You can permanently store the contents of the index in the +repository with git-commit(1):

+
+
+
$ git commit
+
+

This will prompt you for a commit message. You've now stored the first +version of your project in git.

+
+

Making changes

+
+

Modify some files, then add their updated contents to the index:

+
+
+
$ git add file1 file2 file3
+
+

You are now ready to commit. You can see what is about to be committed +using git-diff(1) with the --cached option:

+
+
+
$ git diff --cached
+
+

(Without --cached, git-diff(1) will show you any changes that +you've made but not yet added to the index.) You can also get a brief +summary of the situation with git-status(1):

+
+
+
$ git status
+# On branch master
+# Changes to be committed:
+#   (use "git reset HEAD <file>..." to unstage)
+#
+#       modified:   file1
+#       modified:   file2
+#       modified:   file3
+#
+
+

If you need to make any further adjustments, do so now, and then add any +newly modified content to the index. Finally, commit your changes with:

+
+
+
$ git commit
+
+

This will again prompt your for a message describing the change, and then +record a new version of the project.

+

Alternatively, instead of running git add beforehand, you can use

+
+
+
$ git commit -a
+
+

which will automatically notice any modified (but not new) files, add +them to the index, and commit, all in one step.

+

A note on commit messages: Though not required, it's a good idea to +begin the commit message with a single short (less than 50 character) +line summarizing the change, followed by a blank line and then a more +thorough description. Tools that turn commits into email, for +example, use the first line on the Subject: line and the rest of the +commit in the body.

+
+

Git tracks content not files

+
+

Many revision control systems provide an "add" command that tells the +system to start tracking changes to a new file. Git's "add" command +does something simpler and more powerful: git add is used both for new +and newly modified files, and in both cases it takes a snapshot of the +given files and stages that content in the index, ready for inclusion in +the next commit.

+
+

Viewing project history

+
+

At any point you can view the history of your changes using

+
+
+
$ git log
+
+

If you also want to see complete diffs at each step, use

+
+
+
$ git log -p
+
+

Often the overview of the change is useful to get a feel of +each step

+
+
+
$ git log --stat --summary
+
+
+

Managing branches

+
+

A single git repository can maintain multiple branches of +development. To create a new branch named "experimental", use

+
+
+
$ git branch experimental
+
+

If you now run

+
+
+
$ git branch
+
+

you'll get a list of all existing branches:

+
+
+
  experimental
+* master
+
+

The "experimental" branch is the one you just created, and the +"master" branch is a default branch that was created for you +automatically. The asterisk marks the branch you are currently on; +type

+
+
+
$ git checkout experimental
+
+

to switch to the experimental branch. Now edit a file, commit the +change, and switch back to the master branch:

+
+
+
(edit file)
+$ git commit -a
+$ git checkout master
+
+

Check that the change you made is no longer visible, since it was +made on the experimental branch and you're back on the master branch.

+

You can make a different change on the master branch:

+
+
+
(edit file)
+$ git commit -a
+
+

at this point the two branches have diverged, with different changes +made in each. To merge the changes made in experimental into master, run

+
+
+
$ git merge experimental
+
+

If the changes don't conflict, you're done. If there are conflicts, +markers will be left in the problematic files showing the conflict;

+
+
+
$ git diff
+
+

will show this. Once you've edited the files to resolve the +conflicts,

+
+
+
$ git commit -a
+
+

will commit the result of the merge. Finally,

+
+
+
$ gitk
+
+

will show a nice graphical representation of the resulting history.

+

At this point you could delete the experimental branch with

+
+
+
$ git branch -d experimental
+
+

This command ensures that the changes in the experimental branch are +already in the current branch.

+

If you develop on a branch crazy-idea, then regret it, you can always +delete the branch with

+
+
+
$ git branch -D crazy-idea
+
+

Branches are cheap and easy, so this is a good way to try something +out.

+
+

Using git for collaboration

+
+

Suppose that Alice has started a new project with a git repository in +/home/alice/project, and that Bob, who has a home directory on the +same machine, wants to contribute.

+

Bob begins with:

+
+
+
$ git clone /home/alice/project myrepo
+
+

This creates a new directory "myrepo" containing a clone of Alice's +repository. The clone is on an equal footing with the original +project, possessing its own copy of the original project's history.

+

Bob then makes some changes and commits them:

+
+
+
(edit files)
+$ git commit -a
+(repeat as necessary)
+
+

When he's ready, he tells Alice to pull changes from the repository +at /home/bob/myrepo. She does this with:

+
+
+
$ cd /home/alice/project
+$ git pull /home/bob/myrepo master
+
+

This merges the changes from Bob's "master" branch into Alice's +current branch. If Alice has made her own changes in the meantime, +then she may need to manually fix any conflicts. (Note that the +"master" argument in the above command is actually unnecessary, as it +is the default.)

+

The "pull" command thus performs two operations: it fetches changes +from a remote branch, then merges them into the current branch.

+

When you are working in a small closely knit group, it is not +unusual to interact with the same repository over and over +again. By defining remote repository shorthand, you can make +it easier:

+
+
+
$ git remote add bob /home/bob/myrepo
+
+

With this, Alice can perform the first operation alone using the +"git fetch" command without merging them with her own branch, +using:

+
+
+
$ git fetch bob
+
+

Unlike the longhand form, when Alice fetches from Bob using a +remote repository shorthand set up with git remote, what was +fetched is stored in a remote tracking branch, in this case +bob/master. So after this:

+
+
+
$ git log -p master..bob/master
+
+

shows a list of all the changes that Bob made since he branched from +Alice's master branch.

+

After examining those changes, Alice +could merge the changes into her master branch:

+
+
+
$ git merge bob/master
+
+

This merge can also be done by pulling from her own remote +tracking branch, like this:

+
+
+
$ git pull . remotes/bob/master
+
+

Note that git pull always merges into the current branch, +regardless of what else is given on the command line.

+

Later, Bob can update his repo with Alice's latest changes using

+
+
+
$ git pull
+
+

Note that he doesn't need to give the path to Alice's repository; +when Bob cloned Alice's repository, git stored the location of her +repository in the repository configuration, and that location is +used for pulls:

+
+
+
$ git config --get remote.origin.url
+/home/alice/project
+
+

(The complete configuration created by git-clone is visible using +"git config -l", and the git-config(1) man page +explains the meaning of each option.)

+

Git also keeps a pristine copy of Alice's master branch under the +name "origin/master":

+
+
+
$ git branch -r
+  origin/master
+
+

If Bob later decides to work from a different host, he can still +perform clones and pulls using the ssh protocol:

+
+
+
$ git clone alice.org:/home/alice/project myrepo
+
+

Alternatively, git has a native protocol, or can use rsync or http; +see git-pull(1) for details.

+

Git can also be used in a CVS-like mode, with a central repository +that various users push changes to; see git-push(1) and +gitcvs-migration(7)[git for CVS users].

+
+

Exploring history

+
+

Git history is represented as a series of interrelated commits. We +have already seen that the git log command can list those commits. +Note that first line of each git log entry also gives a name for the +commit:

+
+
+
$ git log
+commit c82a22c39cbc32576f64f5c6b3f24b99ea8149c7
+Author: Junio C Hamano <junkio@cox.net>
+Date:   Tue May 16 17:18:22 2006 -0700
+
+    merge-base: Clarify the comments on post processing.
+
+

We can give this name to git show to see the details about this +commit.

+
+
+
$ git show c82a22c39cbc32576f64f5c6b3f24b99ea8149c7
+
+

But there are other ways to refer to commits. You can use any initial +part of the name that is long enough to uniquely identify the commit:

+
+
+
$ git show c82a22c39c   # the first few characters of the name are
+                        # usually enough
+$ git show HEAD         # the tip of the current branch
+$ git show experimental # the tip of the "experimental" branch
+
+

Every commit usually has one "parent" commit +which points to the previous state of the project:

+
+
+
$ git show HEAD^  # to see the parent of HEAD
+$ git show HEAD^^ # to see the grandparent of HEAD
+$ git show HEAD~4 # to see the great-great grandparent of HEAD
+
+

Note that merge commits may have more than one parent:

+
+
+
$ git show HEAD^1 # show the first parent of HEAD (same as HEAD^)
+$ git show HEAD^2 # show the second parent of HEAD
+
+

You can also give commits names of your own; after running

+
+
+
$ git-tag v2.5 1b2e1d63ff
+
+

you can refer to 1b2e1d63ff by the name "v2.5". If you intend to +share this name with other people (for example, to identify a release +version), you should create a "tag" object, and perhaps sign it; see +git-tag(1) for details.

+

Any git command that needs to know a commit can take any of these +names. For example:

+
+
+
$ git diff v2.5 HEAD     # compare the current HEAD to v2.5
+$ git branch stable v2.5 # start a new branch named "stable" based
+                         # at v2.5
+$ git reset --hard HEAD^ # reset your current branch and working
+                         # directory to its state at HEAD^
+
+

Be careful with that last command: in addition to losing any changes +in the working directory, it will also remove all later commits from +this branch. If this branch is the only branch containing those +commits, they will be lost. Also, don't use "git reset" on a +publicly-visible branch that other developers pull from, as it will +force needless merges on other developers to clean up the history. +If you need to undo changes that you have pushed, use git-revert(1) +instead.

+

The git grep command can search for strings in any version of your +project, so

+
+
+
$ git grep "hello" v2.5
+
+

searches for all occurrences of "hello" in v2.5.

+

If you leave out the commit name, git grep will search any of the +files it manages in your current directory. So

+
+
+
$ git grep "hello"
+
+

is a quick way to search just the files that are tracked by git.

+

Many git commands also take sets of commits, which can be specified +in a number of ways. Here are some examples with git log:

+
+
+
$ git log v2.5..v2.6            # commits between v2.5 and v2.6
+$ git log v2.5..                # commits since v2.5
+$ git log --since="2 weeks ago" # commits from the last 2 weeks
+$ git log v2.5.. Makefile       # commits since v2.5 which modify
+                                # Makefile
+
+

You can also give git log a "range" of commits where the first is not +necessarily an ancestor of the second; for example, if the tips of +the branches "stable-release" and "master" diverged from a common +commit some time ago, then

+
+
+
$ git log stable..experimental
+
+

will list commits made in the experimental branch but not in the +stable branch, while

+
+
+
$ git log experimental..stable
+
+

will show the list of commits made on the stable branch but not +the experimental branch.

+

The "git log" command has a weakness: it must present commits in a +list. When the history has lines of development that diverged and +then merged back together, the order in which "git log" presents +those commits is meaningless.

+

Most projects with multiple contributors (such as the linux kernel, +or git itself) have frequent merges, and gitk does a better job of +visualizing their history. For example,

+
+
+
$ gitk --since="2 weeks ago" drivers/
+
+

allows you to browse any commits from the last 2 weeks of commits +that modified files under the "drivers" directory. (Note: you can +adjust gitk's fonts by holding down the control key while pressing +"-" or "+".)

+

Finally, most commands that take filenames will optionally allow you +to precede any filename by a commit, to specify a particular version +of the file:

+
+
+
$ git diff v2.5:Makefile HEAD:Makefile.in
+
+

You can also use "git show" to see any such file:

+
+
+
$ git show v2.5:Makefile
+
+
+

Next Steps

+
+

This tutorial should be enough to perform basic distributed revision +control for your projects. However, to fully understand the depth +and power of git you need to understand two simple ideas on which it +is based:

+
    +
  • +

    +The object database is the rather elegant system used to + store the history of your project--files, directories, and + commits. +

    +
  • +
  • +

    +The index file is a cache of the state of a directory tree, + used to create commits, check out working directories, and + hold the various trees involved in a merge. +

    +
  • +
+

gittutorial-2(7)[Part two of this tutorial] explains the object +database, the index file, and a few other odds and ends that you'll +need to make the most of git.

+

If you don't want to continue with that right away, a few other +digressions that may be interesting at this point are:

+
    +
  • +

    +git-format-patch(1), git-am(1): These convert + series of git commits into emailed patches, and vice versa, + useful for projects such as the linux kernel which rely heavily + on emailed patches. +

    +
  • +
  • +

    +git-bisect(1): When there is a regression in your + project, one way to track down the bug is by searching through + the history to find the exact commit that's to blame. Git bisect + can help you perform a binary search for that commit. It is + smart enough to perform a close-to-optimal search even in the + case of complex non-linear history with lots of merged branches. +

    +
  • +
  • +

    +Everyday GIT with 20 Commands Or So +

    +
  • +
  • +

    +gitcvs-migration(7)[git for CVS users]. +

    +
  • +
+
+

SEE ALSO

+ +

GIT

+
+

Part of the git(7) suite.

+
+ + + diff --git a/tutorial.txt b/gittutorial.txt similarity index 97% rename from tutorial.txt rename to gittutorial.txt index e2bbda53f..898acdb53 100644 --- a/tutorial.txt +++ b/gittutorial.txt @@ -1,5 +1,16 @@ -A tutorial introduction to git (for version 1.5.1 or newer) -=========================================================== +gittutorial(7) +============== + +NAME +---- +gittutorial - A tutorial introduction to git (for version 1.5.1 or newer) + +SYNOPSIS +-------- +git * + +DESCRIPTION +----------- This tutorial explains how to import a new project into git, make changes to it, and share changes with other developers. @@ -381,7 +392,7 @@ see linkgit:git-pull[1] for details. Git can also be used in a CVS-like mode, with a central repository that various users push changes to; see linkgit:git-push[1] and -link:cvs-migration.html[git for CVS users]. +linkgit:gitcvs-migration[7][git for CVS users]. Exploring history ----------------- @@ -560,7 +571,7 @@ is based: used to create commits, check out working directories, and hold the various trees involved in a merge. -link:tutorial-2.html[Part two of this tutorial] explains the object +linkgit:gittutorial-2[7][Part two of this tutorial] explains the object database, the index file, and a few other odds and ends that you'll need to make the most of git. @@ -581,4 +592,15 @@ digressions that may be interesting at this point are: * link:everyday.html[Everyday GIT with 20 Commands Or So] - * link:cvs-migration.html[git for CVS users]. + * linkgit:gitcvs-migration[7][git for CVS users]. + +SEE ALSO +-------- +linkgit:gittutorial-2[7], +linkgit:gitcvs-migration[7], +link:everyday.html[Everyday git], +link:user-manual.html[The Git User's Manual] + +GIT +--- +Part of the linkgit:git[7] suite. diff --git a/technical/api-history-graph.html b/technical/api-history-graph.html index a0e0231e5..8489a3d7d 100644 --- a/technical/api-history-graph.html +++ b/technical/api-history-graph.html @@ -437,7 +437,7 @@ The graph API does not currently support reverse commit ordering. In
struct commit *commit;
-struct git_graph *graph = graph_init();
+struct git_graph *graph = graph_init(opts);
 
 while ((commit = get_revision(opts)) != NULL) {
         graph_update(graph, commit);
@@ -501,7 +501,7 @@ M-. \ \
 
diff --git a/technical/api-history-graph.txt b/technical/api-history-graph.txt index ce1c08ee8..e9559790a 100644 --- a/technical/api-history-graph.txt +++ b/technical/api-history-graph.txt @@ -115,7 +115,7 @@ Sample usage ------------ struct commit *commit; -struct git_graph *graph = graph_init(); +struct git_graph *graph = graph_init(opts); while ((commit = get_revision(opts)) != NULL) { graph_update(graph, commit); diff --git a/user-manual.html b/user-manual.html index 71d5f8e44..9b311aa71 100644 --- a/user-manual.html +++ b/user-manual.html @@ -1,4 +1,4 @@ -Git User's Manual (for version 1.5.3 or newer)

Git User's Manual (for version 1.5.3 or newer)


Table of Contents

Preface
1. Repositories and Branches
How to get a git repository
How to check out a different version of a project
Understanding History: Commits
Understanding history: commits, parents, and reachability
Understanding history: History diagrams
Understanding history: What is a branch?
Manipulating branches
Examining an old version without creating a new branch
Examining branches from a remote repository
Naming branches, tags, and other references
Updating a repository with git fetch
Fetching branches from other repositories
2. Exploring git history
How to use bisect to find a regression
Naming commits
Creating tags
Browsing revisions
Generating diffs
Viewing old file versions
Examples
Counting the number of commits on a branch
Check whether two branches point at the same history
Find first tagged version including a given fix
Showing commits unique to a given branch
Creating a changelog and tarball for a software release
Finding commits referencing a file with given content
3. Developing with git
Telling git your name
Creating a new repository
How to make a commit
Creating good commit messages
Ignoring files
How to merge
Resolving a merge
Getting conflict-resolution help during a merge
Undoing a merge
Fast-forward merges
Fixing mistakes
Fixing a mistake with a new commit
Fixing a mistake by rewriting history
Checking out an old version of a file
Temporarily setting aside work in progress
Ensuring good performance
Ensuring reliability
Checking the repository for corruption
Recovering lost changes
4. Sharing development with others
Getting updates with git pull
Submitting patches to a project
Importing patches to a project
Public git repositories
Setting up a public repository
Exporting a git repository via the git protocol
Exporting a git repository via http
Pushing changes to a public repository
What to do when a push fails
Setting up a shared repository
Allowing web browsing of a repository
Examples
Maintaining topic branches for a Linux subsystem maintainer
5. Rewriting history and maintaining patch series
Creating the perfect patch series
Keeping a patch series up to date using git-rebase
Rewriting a single commit
Reordering or selecting from a patch series
Other tools
Problems with rewriting history
Why bisecting merge commits can be harder than bisecting linear history
6. Advanced branch management
Fetching individual branches
git fetch and fast-forwards
Forcing git fetch to do non-fast-forward updates
Configuring remote branches
7. Git concepts
The Object Database
Commit Object
Tree Object
Blob Object
Trust
Tag Object
How git stores objects efficiently: pack files
Dangling objects
Recovering from repository corruption
The index
8. Submodules
Pitfalls with submodules
9. Low-level git operations
Object access and manipulation
The Workflow
working directory -> index
index -> object database
object database -> index
index -> working directory
Tying it all together
Examining the data
Merging multiple trees
Merging multiple trees, continued
10. Hacking git
Object storage format
A birds-eye view of Git's source code
11. GIT Glossary
A. Git Quick Reference
Creating a new repository
Managing branches
Exploring history
Making changes
Merging
Sharing your changes
Repository maintenance
B. Notes and todo list for this manual

Preface

Git is a fast distributed revision control system.

This manual is designed to be readable by someone with basic UNIX +Git User's Manual (for version 1.5.3 or newer)

Git User's Manual (for version 1.5.3 or newer)


Table of Contents

Preface
1. Repositories and Branches
How to get a git repository
How to check out a different version of a project
Understanding History: Commits
Understanding history: commits, parents, and reachability
Understanding history: History diagrams
Understanding history: What is a branch?
Manipulating branches
Examining an old version without creating a new branch
Examining branches from a remote repository
Naming branches, tags, and other references
Updating a repository with git fetch
Fetching branches from other repositories
2. Exploring git history
How to use bisect to find a regression
Naming commits
Creating tags
Browsing revisions
Generating diffs
Viewing old file versions
Examples
Counting the number of commits on a branch
Check whether two branches point at the same history
Find first tagged version including a given fix
Showing commits unique to a given branch
Creating a changelog and tarball for a software release
Finding commits referencing a file with given content
3. Developing with git
Telling git your name
Creating a new repository
How to make a commit
Creating good commit messages
Ignoring files
How to merge
Resolving a merge
Getting conflict-resolution help during a merge
Undoing a merge
Fast-forward merges
Fixing mistakes
Fixing a mistake with a new commit
Fixing a mistake by rewriting history
Checking out an old version of a file
Temporarily setting aside work in progress
Ensuring good performance
Ensuring reliability
Checking the repository for corruption
Recovering lost changes
4. Sharing development with others
Getting updates with git pull
Submitting patches to a project
Importing patches to a project
Public git repositories
Setting up a public repository
Exporting a git repository via the git protocol
Exporting a git repository via http
Pushing changes to a public repository
What to do when a push fails
Setting up a shared repository
Allowing web browsing of a repository
Examples
Maintaining topic branches for a Linux subsystem maintainer
5. Rewriting history and maintaining patch series
Creating the perfect patch series
Keeping a patch series up to date using git-rebase
Rewriting a single commit
Reordering or selecting from a patch series
Other tools
Problems with rewriting history
Why bisecting merge commits can be harder than bisecting linear history
6. Advanced branch management
Fetching individual branches
git fetch and fast-forwards
Forcing git fetch to do non-fast-forward updates
Configuring remote branches
7. Git concepts
The Object Database
Commit Object
Tree Object
Blob Object
Trust
Tag Object
How git stores objects efficiently: pack files
Dangling objects
Recovering from repository corruption
The index
8. Submodules
Pitfalls with submodules
9. Low-level git operations
Object access and manipulation
The Workflow
working directory -> index
index -> object database
object database -> index
index -> working directory
Tying it all together
Examining the data
Merging multiple trees
Merging multiple trees, continued
10. Hacking git
Object storage format
A birds-eye view of Git's source code
11. GIT Glossary
A. Git Quick Reference
Creating a new repository
Managing branches
Exploring history
Making changes
Merging
Sharing your changes
Repository maintenance
B. Notes and todo list for this manual

Preface

Git is a fast distributed revision control system.

This manual is designed to be readable by someone with basic UNIX command-line skills, but no previous knowledge of git.

Chapter 1, Repositories and Branches and Chapter 2, Exploring git history explain how to fetch and study a project using git—read these chapters to learn how to build and test a particular version of a software project, search for @@ -780,10 +780,10 @@ the right to push to the same repository. In that case, the correct solution is to retry the push after first updating your work by either a pull or a fetch followed by a rebase; see the next section and -git for CVS users for more.

Setting up a shared repository

Another way to collaborate is by using a model similar to that +gitcvs-migration(7)[git for CVS users] for more.

Setting up a shared repository

Another way to collaborate is by using a model similar to that commonly used in CVS, where several developers with special rights all push to and pull from a single shared repository. See -git for CVS users for instructions on how to +gitcvs-migration(7)[git for CVS users] for instructions on how to set this up.

However, while there is nothing wrong with git's support for shared repositories, this mode of operation is not generally recommended, simply because the mode of collaboration that git supports—by @@ -1442,7 +1442,7 @@ column in the git-ls-files(1) outp number, and will take on values other than 0 for files with merge conflicts.

The index is thus a sort of temporary staging area, which is filled with a tree which you are in the process of working on.

If you blow the index away entirely, you generally haven't lost any -information as long as you have the name of the tree that it described.

Chapter 8. Submodules

Table of Contents

Pitfalls with submodules

Large projects are often composed of smaller, self-contained modules. For +information as long as you have the name of the tree that it described.

Chapter 8. Submodules

Table of Contents

Pitfalls with submodules

Large projects are often composed of smaller, self-contained modules. For example, an embedded Linux distribution's source tree would include every piece of software in the distribution with some local modifications; a movie player might need to build against a specific, known-working version of a @@ -1536,7 +1536,7 @@ index d266b98..261dfac 160000
$ git add a
$ git commit -m "Updated submodule a."
$ git push

You have to run git submodule update after git pull if you want to update -submodules, too.

Pitfalls with submodules

Always publish the submodule change before publishing the change to the +submodules, too.

Pitfalls with submodules

Always publish the submodule change before publishing the change to the superproject that references it. If you forget to publish the submodule change, others won't be able to clone the repository:

$ cd ~/git/super/a
$ echo i added another line to this file >> a.txt
diff --git a/user-manual.txt b/user-manual.txt index e2db85015..fd8cdb625 100644 --- a/user-manual.txt +++ b/user-manual.txt @@ -1993,7 +1993,7 @@ the right to push to the same repository. In that case, the correct solution is to retry the push after first updating your work by either a pull or a fetch followed by a rebase; see the <> and -link:cvs-migration.html[git for CVS users] for more. +linkgit:gitcvs-migration[7][git for CVS users] for more. [[setting-up-a-shared-repository]] Setting up a shared repository @@ -2002,7 +2002,7 @@ Setting up a shared repository Another way to collaborate is by using a model similar to that commonly used in CVS, where several developers with special rights all push to and pull from a single shared repository. See -link:cvs-migration.html[git for CVS users] for instructions on how to +linkgit:gitcvs-migration[7][git for CVS users] for instructions on how to set this up. However, while there is nothing wrong with git's support for shared