From: Junio C Hamano Date: Tue, 17 Apr 2007 08:28:11 +0000 (+0000) Subject: Autogenerated HTML docs for v1.5.1.1-135-gf948 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0e3cb537e5dee1347d53fc91ed855a1e84127503;p=git.git Autogenerated HTML docs for v1.5.1.1-135-gf948 --- diff --git a/blame-options.txt b/blame-options.txt new file mode 100644 index 000000000..331f161c7 --- /dev/null +++ b/blame-options.txt @@ -0,0 +1,67 @@ +-b:: + Show blank SHA-1 for boundary commits. This can also + be controlled via the `blame.blankboundary` config option. + +--root:: + Do not treat root commits as boundaries. This can also be + controlled via the `blame.showroot` config option. + +--show-stats:: + Include additional statistics at the end of blame output. + +-L n,m:: + Annotate only the specified line range (lines count from 1). + +-l:: + Show long rev (Default: off). + +-t:: + Show raw timestamp (Default: off). + +-S :: + Use revs from revs-file instead of calling gitlink:git-rev-list[1]. + +-p, --porcelain:: + Show in a format designed for machine consumption. + +--incremental:: + Show the result incrementally in a format designed for + machine consumption. + +--contents :: + When is not specified, the command annotates the + changes starting backwards from the working tree copy. + This flag makes the command pretend as if the working + tree copy has the contents of he named file (specify + `-` to make the command read from the standard input). + +-M||:: + Detect moving lines in the file as well. When a commit + moves a block of lines in a file (e.g. the original file + has A and then B, and the commit changes it to B and + then A), traditional 'blame' algorithm typically blames + the lines that were moved up (i.e. B) to the parent and + assigns blame to the lines that were moved down (i.e. A) + to the child commit. With this option, both groups of lines + are blamed on the parent. + + is optional but it is the lower bound on the number of + alphanumeric characters that git must detect as moving + within a file for it to associate those lines with the parent + commit. + +-C||:: + In addition to `-M`, detect lines copied from other + files that were modified in the same commit. This is + useful when you reorganize your program and move code + around across files. When this option is given twice, + the command looks for copies from all other files in the + parent for the commit that creates the file in addition. + + is optional but it is the lower bound on the number of + alphanumeric characters that git must detect as moving + between files for it to associate those lines with the parent + commit. + +-h, --help:: + Show help message. diff --git a/git-am.html b/git-am.html index a41714cc0..f2a433f82 100644 --- a/git-am.html +++ b/git-am.html @@ -297,7 +297,7 @@ current branch.

---signoff +-s, --signoff

@@ -306,7 +306,7 @@ current branch.

---dotest=<dir> +-d=<dir>, --dotest=<dir>

@@ -315,7 +315,7 @@ current branch.

---keep +-k, --keep

@@ -323,7 +323,7 @@ current branch.

---utf8 +-u, --utf8

@@ -341,12 +341,12 @@ default. You could use --no-utf8 to override this.

- Do not pass -u flag to git-mailinfo (see + Pass -n flag to git-mailinfo (see git-mailinfo(1)).

---binary +-b, --binary

@@ -355,7 +355,7 @@ default. You could use --no-utf8 to override this.

---3way +-3, --3way

@@ -393,7 +393,7 @@ default. You could use --no-utf8 to override this.

---interactive +-i, --interactive

@@ -401,7 +401,7 @@ default. You could use --no-utf8 to override this.

---resolved +-r, --resolved

@@ -413,6 +413,18 @@ default. You could use --no-utf8 to override this.

file, and continue.

+
+--resolvemsg=<msg> +
+
+

+ When a patch failure occurs, <msg> will be printed + to the screen before exiting. This overrides the + standard message informing you to use --resolved + or --skip to handle the failure. This is solely + for internal use between git-rebase and git-am. +

+

DISCUSSION

@@ -494,7 +506,7 @@ names.

diff --git a/git-am.txt b/git-am.txt index 148ce4056..f0405a35e 100644 --- a/git-am.txt +++ b/git-am.txt @@ -26,18 +26,18 @@ OPTIONS The list of mailbox files to read patches from. If you do not supply this argument, reads from the standard input. ---signoff:: +-s, --signoff:: Add `Signed-off-by:` line to the commit message, using the committer identity of yourself. ---dotest=:: +-d=, --dotest=:: Instead of `.dotest` directory, use as a working area to store extracted patches. ---keep:: +-k, --keep:: Pass `-k` flag to `git-mailinfo` (see gitlink:git-mailinfo[1]). ---utf8:: +-u, --utf8:: Pass `-u` flag to `git-mailinfo` (see gitlink:git-mailinfo[1]). The proposed commit log message taken from the e-mail are re-coded into UTF-8 encoding (configuration variable @@ -48,14 +48,14 @@ This was optional in prior versions of git, but now it is the default. You could use `--no-utf8` to override this. --no-utf8:: - Do not pass `-u` flag to `git-mailinfo` (see + Pass `-n` flag to `git-mailinfo` (see gitlink:git-mailinfo[1]). ---binary:: +-b, --binary:: Pass `--allow-binary-replacement` flag to `git-apply` (see gitlink:git-apply[1]). ---3way:: +-3, --3way:: When the patch does not apply cleanly, 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 @@ -73,10 +73,10 @@ default. You could use `--no-utf8` to override this. These flags are passed to the `git-apply` program that applies the patch. ---interactive:: +-i, --interactive:: Run interactively, just like git-applymbox. ---resolved:: +-r, --resolved:: After a patch failure (e.g. attempting to apply conflicting patch), the user has applied it by hand and the index file stores the result of the application. @@ -84,6 +84,13 @@ default. You could use `--no-utf8` to override this. extracted from the e-mail message and the current index file, and continue. +--resolvemsg=:: + When a patch failure occurs, will be printed + to the screen before exiting. This overrides the + standard message informing you to use `--resolved` + or `--skip` to handle the failure. This is solely + for internal use between `git-rebase` and `git-am`. + DISCUSSION ---------- diff --git a/git-annotate.html b/git-annotate.html index 51959f475..a8a6215b3 100644 --- a/git-annotate.html +++ b/git-annotate.html @@ -283,38 +283,135 @@ which introduced the line. Optionally annotate from a given revision.

--l, --long +-b

- Show long rev (Defaults off). + Show blank SHA-1 for boundary commits. This can also + be controlled via the blame.blankboundary config option.

--t, --time +--root

- Show raw timestamp (Defaults off). + Do not treat root commits as boundaries. This can also be + controlled via the blame.showroot config option.

--r, --rename +--show-stats

- Follow renames (Defaults on). + Include additional statistics at the end of blame output.

--S, --rev-file <revs-file> +-L n,m

- Use revs from revs-file instead of calling git-rev-list. + Annotate only the specified line range (lines count from 1).

+-l +
+
+

+ Show long rev (Default: off). +

+
+
+-t +
+
+

+ Show raw timestamp (Default: off). +

+
+
+-S <revs-file> +
+
+

+ Use revs from revs-file instead of calling git-rev-list(1). +

+
+
+-p, --porcelain +
+
+

+ Show in a format designed for machine consumption. +

+
+
+--incremental +
+
+

+ Show the result incrementally in a format designed for + machine consumption. +

+
+
+--contents <file> +
+
+

+ When <rev> is not specified, the command annotates the + changes starting backwards from the working tree copy. + This flag makes the command pretend as if the working + tree copy has the contents of he named file (specify + - to make the command read from the standard input). +

+
+
+-M|<num>| +
+
+

+ Detect moving lines in the file as well. When a commit + moves a block of lines in a file (e.g. the original file + has A and then B, and the commit changes it to B and + then A), traditional blame algorithm typically blames + the lines that were moved up (i.e. B) to the parent and + assigns blame to the lines that were moved down (i.e. A) + to the child commit. With this option, both groups of lines + are blamed on the parent. +

+
+
+
<num> is optional but it is the lower bound on the number of
+alphanumeric characters that git must detect as moving
+within a file for it to associate those lines with the parent
+commit.
+
+
+
+-C|<num>| +
+
+

+ In addition to -M, detect lines copied from other + files that were modified in the same commit. This is + useful when you reorganize your program and move code + around across files. When this option is given twice, + the command looks for copies from all other files in the + parent for the commit that creates the file in addition. +

+
+
+
<num> is optional but it is the lower bound on the number of
+alphanumeric characters that git must detect as moving
+between files for it to associate those lines with the parent
+commit.
+
+
+
-h, --help
@@ -338,7 +435,7 @@ which introduced the line. Optionally annotate from a given revision.

diff --git a/git-annotate.txt b/git-annotate.txt index 7baf73111..02dc4740d 100644 --- a/git-annotate.txt +++ b/git-annotate.txt @@ -16,20 +16,7 @@ which introduced the line. Optionally annotate from a given revision. OPTIONS ------- --l, --long:: - Show long rev (Defaults off). - --t, --time:: - Show raw timestamp (Defaults off). - --r, --rename:: - Follow renames (Defaults on). - --S, --rev-file :: - Use revs from revs-file instead of calling git-rev-list. - --h, --help:: - Show help message. +include::blame-options.txt[] SEE ALSO -------- diff --git a/git-apply.html b/git-apply.html index 8f6361dc2..703476871 100644 --- a/git-apply.html +++ b/git-apply.html @@ -273,11 +273,12 @@ git-apply(1) Manual Page

SYNOPSIS

-
git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--apply] - [--no-add] [--index-info] [--allow-binary-replacement | --binary] - [-R | --reverse] [--reject] [-z] [-pNUM] [-CNUM] [--inaccurate-eof] - [--whitespace=<nowarn|warn|error|error-all|strip>] [--exclude=PATH] - [--cached] [--verbose] [<patch>…]
+
git-apply [--stat] [--numstat] [--summary] [--check] [--index] + [--apply] [--no-add] [--index-info] [-R | --reverse] + [--allow-binary-replacement | --binary] [--reject] [-z] + [-pNUM] [-CNUM] [--inaccurate-eof] [--cached] + [--whitespace=<nowarn|warn|error|error-all|strip>] + [--exclude=PATH] [--verbose] [<patch>…]

DESCRIPTION

@@ -544,7 +545,7 @@ discouraged.

---verbose +-v, --verbose

@@ -583,7 +584,7 @@ apply.whitespace

diff --git a/git-apply.txt b/git-apply.txt index 065ba1bf2..3bd2c995d 100644 --- a/git-apply.txt +++ b/git-apply.txt @@ -9,11 +9,12 @@ git-apply - Apply a patch on a git index file and a working tree SYNOPSIS -------- [verse] -'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply] - [--no-add] [--index-info] [--allow-binary-replacement | --binary] - [-R | --reverse] [--reject] [-z] [-pNUM] [-CNUM] [--inaccurate-eof] - [--whitespace=] [--exclude=PATH] - [--cached] [--verbose] [...] +'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] + [--apply] [--no-add] [--index-info] [-R | --reverse] + [--allow-binary-replacement | --binary] [--reject] [-z] + [-pNUM] [-CNUM] [--inaccurate-eof] [--cached] + [--whitespace=] + [--exclude=PATH] [--verbose] [...] DESCRIPTION ----------- @@ -158,7 +159,7 @@ discouraged. correctly. This option adds support for applying such patches by working around this bug. ---verbose:: +-v, --verbose:: Report progress to stderr. By default, only a message about the current patch being applied will be printed. This option will cause additional information to be reported. diff --git a/git-applymbox.html b/git-applymbox.html index 1a6ab5160..f3af7b988 100644 --- a/git-applymbox.html +++ b/git-applymbox.html @@ -325,15 +325,26 @@ current branch.

- The commit log message, author name and author email are - taken from the e-mail, and after minimally decoding MIME - transfer encoding, re-coded in UTF-8 by transliterating - them. This used to be optional but now it is the default. + Pass -u flag to git-mailinfo (see git-mailinfo(1)). + The proposed commit log message taken from the e-mail + are re-coded into UTF-8 encoding (configuration variable + i18n.commitencoding can be used to specify project's + preferred encoding if it is not UTF-8). This used to be + optional but now it is the default.

Note that the patch is always used as-is without charset conversion, even with this flag.

+-n +
+
+

+ Pass -n flag to git-mailinfo (see + git-mailinfo(1)). +

+
+
-c .dotest/<num>
@@ -390,7 +401,7 @@ conversion, even with this flag.

diff --git a/git-applymbox.txt b/git-applymbox.txt index 95dc65a58..3bc92d8cf 100644 --- a/git-applymbox.txt +++ b/git-applymbox.txt @@ -42,14 +42,20 @@ OPTIONS and the current tree. -u:: - The commit log message, author name and author email are - taken from the e-mail, and after minimally decoding MIME - transfer encoding, re-coded in UTF-8 by transliterating - them. This used to be optional but now it is the default. + Pass `-u` flag to `git-mailinfo` (see gitlink:git-mailinfo[1]). + The proposed commit log message taken from the e-mail + are re-coded into UTF-8 encoding (configuration variable + `i18n.commitencoding` can be used to specify project's + preferred encoding if it is not UTF-8). This used to be + optional but now it is the default. + Note that the patch is always used as-is without charset conversion, even with this flag. +-n:: + Pass `-n` flag to `git-mailinfo` (see + gitlink:git-mailinfo[1]). + -c .dotest/:: When the patch contained in an e-mail does not cleanly apply, the command exits with an error message. The diff --git a/git-blame.html b/git-blame.html index e6605e123..c76fe7618 100644 --- a/git-blame.html +++ b/git-blame.html @@ -273,8 +273,9 @@ git-blame(1) Manual Page

SYNOPSIS

-
git-blame [-c] [-l] [-t] [-f] [-n] [-p] [--incremental] [-L n,m] [-S <revs-file>] - [-M] [-C] [-C] [--since=<date>] [<rev> | --contents <file>] [--] <file>
+
git-blame [-c] [-l] [-t] [-f] [-n] [-p] [--incremental] [-L n,m] + [-S <revs-file>] [-M] [-C] [-C] [--since=<date>] + [<rev> | --contents <file>] [--] <file>

DESCRIPTION

@@ -300,61 +301,61 @@ ea4c7f9bf69e781dd0cd88d2bccb2bf5cc15c9a7 git-blame: Make the output
--c, --compatibility +-b

- Use the same output mode as git-annotate(1) (Default: off). + Show blank SHA-1 for boundary commits. This can also + be controlled via the blame.blankboundary config option.

--L n,m +--root

- Annotate only the specified line range (lines count from 1). + Do not treat root commits as boundaries. This can also be + controlled via the blame.showroot config option.

--l, --long +--show-stats

- Show long rev (Default: off). + Include additional statistics at the end of blame output.

--t, --time +-L n,m

- Show raw timestamp (Default: off). + Annotate only the specified line range (lines count from 1).

--S, --rev-file <revs-file> +-l

- Use revs from revs-file instead of calling git-rev-list(1). + Show long rev (Default: off).

--f, --show-name +-t

- Show filename in the original commit. By default - filename is shown if there is any line that came from a - file with different name, due to rename detection. + Show raw timestamp (Default: off).

--n, --show-number +-S <revs-file>

- Show line number in the original commit (Default: off). + Use revs from revs-file instead of calling git-rev-list(1).

@@ -387,7 +388,7 @@ ea4c7f9bf69e781dd0cd88d2bccb2bf5cc15c9a7 git-blame: Make the output

--M +-M|<num>|

@@ -397,12 +398,19 @@ ea4c7f9bf69e781dd0cd88d2bccb2bf5cc15c9a7 git-blame: Make the output then A), traditional blame algorithm typically blames the lines that were moved up (i.e. B) to the parent and assigns blame to the lines that were moved down (i.e. A) - to the child commit. With this option, both groups of - lines are blamed on the parent. + to the child commit. With this option, both groups of lines + are blamed on the parent.

+
+
+
<num> is optional but it is the lower bound on the number of
+alphanumeric characters that git must detect as moving
+within a file for it to associate those lines with the parent
+commit.
+
--C +-C|<num>|

@@ -413,6 +421,13 @@ ea4c7f9bf69e781dd0cd88d2bccb2bf5cc15c9a7 git-blame: Make the output the command looks for copies from all other files in the parent for the commit that creates the file in addition.

+
+
+
<num> is optional but it is the lower bound on the number of
+alphanumeric characters that git must detect as moving
+between files for it to associate those lines with the parent
+commit.
+
-h, --help @@ -422,6 +437,46 @@ ea4c7f9bf69e781dd0cd88d2bccb2bf5cc15c9a7 git-blame: Make the output Show help message.

+
+-c +
+
+

+ Use the same output mode as git-annotate(1) (Default: off). +

+
+
+--score-debug +
+
+

+ Include debugging information related to the movement of + lines between files (see -C) and lines moved within a + file (see -M). The first number listed is the score. + This is the number of alphanumeric characters detected + to be moved between or within files. This must be above + a certain threshold for git-blame to consider those lines + of code to have been moved. +

+
+
+-f, --show-name +
+
+

+ Show filename in the original commit. By default + filename is shown if there is any line that came from a + file with different name, due to rename detection. +

+
+
+-n, --show-number +
+
+

+ Show line number in the original commit (Default: off). +

+

THE PORCELAIN FORMAT

@@ -595,7 +650,7 @@ commit commentary), a blame viewer won't ever care. diff --git a/git-blame.txt b/git-blame.txt index 5c9888d01..8f9439a6d 100644 --- a/git-blame.txt +++ b/git-blame.txt @@ -8,8 +8,9 @@ git-blame - Show what revision and author last modified each line of a file SYNOPSIS -------- [verse] -'git-blame' [-c] [-l] [-t] [-f] [-n] [-p] [--incremental] [-L n,m] [-S ] - [-M] [-C] [-C] [--since=] [ | --contents ] [--] +'git-blame' [-c] [-l] [-t] [-f] [-n] [-p] [--incremental] [-L n,m] + [-S ] [-M] [-C] [-C] [--since=] + [ | --contents ] [--] DESCRIPTION ----------- @@ -37,20 +38,19 @@ ea4c7f9bf69e781dd0cd88d2bccb2bf5cc15c9a7 git-blame: Make the output OPTIONS ------- --c, --compatibility:: - Use the same output mode as gitlink:git-annotate[1] (Default: off). - --L n,m:: - Annotate only the specified line range (lines count from 1). - --l, --long:: - Show long rev (Default: off). +include::blame-options.txt[] --t, --time:: - Show raw timestamp (Default: off). +-c:: + Use the same output mode as gitlink:git-annotate[1] (Default: off). --S, --rev-file :: - Use revs from revs-file instead of calling gitlink:git-rev-list[1]. +--score-debug:: + Include debugging information related to the movement of + lines between files (see `-C`) and lines moved within a + file (see `-M`). The first number listed is the score. + This is the number of alphanumeric characters detected + to be moved between or within files. This must be above + a certain threshold for git-blame to consider those lines + of code to have been moved. -f, --show-name:: Show filename in the original commit. By default @@ -60,42 +60,6 @@ OPTIONS -n, --show-number:: Show line number in the original commit (Default: off). --p, --porcelain:: - Show in a format designed for machine consumption. - ---incremental:: - Show the result incrementally in a format designed for - machine consumption. - ---contents :: - When is not specified, the command annotates the - changes starting backwards from the working tree copy. - This flag makes the command pretend as if the working - tree copy has the contents of he named file (specify - `-` to make the command read from the standard input). - --M:: - Detect moving lines in the file as well. When a commit - moves a block of lines in a file (e.g. the original file - has A and then B, and the commit changes it to B and - then A), traditional 'blame' algorithm typically blames - the lines that were moved up (i.e. B) to the parent and - assigns blame to the lines that were moved down (i.e. A) - to the child commit. With this option, both groups of - lines are blamed on the parent. - --C:: - In addition to `-M`, detect lines copied from other - files that were modified in the same commit. This is - useful when you reorganize your program and move code - around across files. When this option is given twice, - the command looks for copies from all other files in the - parent for the commit that creates the file in addition. - --h, --help:: - Show help message. - - THE PORCELAIN FORMAT -------------------- diff --git a/git-checkout.html b/git-checkout.html index 6bc77b543..e67e39b28 100644 --- a/git-checkout.html +++ b/git-checkout.html @@ -286,9 +286,9 @@ be created; in this case you can use the --track or --no-track options, which will be passed to git branch.

When <paths> are given, this command does not switch branches. It updates the named paths in the working tree from -the index file (i.e. it runs git-checkout-index -f -u), or a -named commit. In -this case, -f and -b options are meaningless and giving +the index file (i.e. it runs git-checkout-index -f -u), or +from a named commit. In +this case, the -f and -b options are meaningless and giving either of them results in an error. <tree-ish> argument can be used to specify a specific tree-ish (i.e. commit, tag or tree) to update the index for the given paths before updating the @@ -310,7 +310,8 @@ working tree.

- Force a re-read of everything. + Proceed even if the index or the working tree differs + from HEAD. This is used to throw away local changes.

@@ -330,8 +331,11 @@ working tree.

When -b is given and a branch is created off a remote branch, - setup so that git-pull will automatically retrieve data from - the remote branch. + set up configuration so that git-pull will automatically + retrieve data from the remote branch. Set the + branch.autosetupmerge configuration variable to true if you + want git-checkout and git-branch to always behave as if + --track were given.

@@ -340,8 +344,9 @@ working tree.

When -b is given and a branch is created off a remote branch, - force that git-pull will automatically retrieve data from - the remote branch independent of the configuration settings. + set up configuration so that git-pull will not retrieve data + from the remote branch, ignoring the branch.autosetupmerge + configuration variable.

@@ -532,7 +537,7 @@ $ git add frotz diff --git a/git-checkout.txt b/git-checkout.txt index f5b2d5017..4f2e847dc 100644 --- a/git-checkout.txt +++ b/git-checkout.txt @@ -23,9 +23,9 @@ options, which will be passed to `git branch`. When are given, this command does *not* switch branches. It updates the named paths in the working tree from -the index file (i.e. it runs `git-checkout-index -f -u`), or a -named commit. In -this case, `-f` and `-b` options are meaningless and giving +the index file (i.e. it runs `git-checkout-index -f -u`), or +from a named commit. In +this case, the `-f` and `-b` options are meaningless and giving either of them results in an error. argument can be used to specify a specific tree-ish (i.e. commit, tag or tree) to update the index for the given paths before updating the @@ -38,7 +38,8 @@ OPTIONS Quiet, supress feedback messages. -f:: - Force a re-read of everything. + Proceed even if the index or the working tree differs + from HEAD. This is used to throw away local changes. -b:: Create a new branch named and start it at @@ -48,13 +49,17 @@ OPTIONS --track:: When -b is given and a branch is created off a remote branch, - setup so that git-pull will automatically retrieve data from - the remote branch. + set up configuration so that git-pull will automatically + retrieve data from the remote branch. Set the + branch.autosetupmerge configuration variable to true if you + want git-checkout and git-branch to always behave as if + '--track' were given. --no-track:: When -b is given and a branch is created off a remote branch, - force that git-pull will automatically retrieve data from - the remote branch independent of the configuration settings. + set up configuration so that git-pull will not retrieve data + from the remote branch, ignoring the branch.autosetupmerge + configuration variable. -l:: Create the new branch's ref log. This activates recording of diff --git a/git-lost-found.html b/git-lost-found.html index 675902826..eb8ec615c 100644 --- a/git-lost-found.html +++ b/git-lost-found.html @@ -277,34 +277,34 @@ git-lost-found(1) Manual Page

DESCRIPTION

Finds dangling commits and tags from the object database, and -creates refs to them in .git/lost-found/ directory. Commits and -tags that dereference to commits go to .git/lost-found/commit -and others are stored in .git/lost-found/other directory.

+creates refs to them in the .git/lost-found/ directory. Commits and +tags that dereference to commits are stored in .git/lost-found/commit, +and other objects are stored in .git/lost-found/other.

OUTPUT

-

One line description from the commit and tag found along with -their object name are printed on the standard output.

+

Prints to standard output the object names and one-line descriptions +of any commits or tags found.

EXAMPLE

-

Suppose you run git tag -f and mistyped the tag to overwrite. +

Suppose you run git tag -f and mistype the tag to overwrite. The ref to your tag is overwritten, but until you run git -prune, it is still there.

+prune, the tag itself is still there.

$ git lost-found
 [1ef2b196d909eed523d4f3c9bf54b78cdd6843c6] GIT 0.99.9c
 ...
-

Also you can use gitk to browse how they relate to each other -and existing (probably old) tags.

+

Also you can use gitk to browse how any tags found relate to each +other.

$ gitk $(cd .git/lost-found/commit && echo ??*)
-

After making sure that it is the object you are looking for, you -can reconnect it to your regular .git/refs hierarchy.

+

After making sure you know which the object is the tag you are looking +for, you can reconnect it to your regular .git/refs hierarchy.

$ git cat-file -t 1ef2b196
@@ -338,7 +338,7 @@ $ git rev-parse not-lost-anymore
 
diff --git a/git-lost-found.txt b/git-lost-found.txt index f52a9d7f6..e48607f00 100644 --- a/git-lost-found.txt +++ b/git-lost-found.txt @@ -12,23 +12,22 @@ SYNOPSIS DESCRIPTION ----------- Finds dangling commits and tags from the object database, and -creates refs to them in .git/lost-found/ directory. Commits and -tags that dereference to commits go to .git/lost-found/commit -and others are stored in .git/lost-found/other directory. +creates refs to them in the .git/lost-found/ directory. Commits and +tags that dereference to commits are stored in .git/lost-found/commit, +and other objects are stored in .git/lost-found/other. OUTPUT ------ -One line description from the commit and tag found along with -their object name are printed on the standard output. - +Prints to standard output the object names and one-line descriptions +of any commits or tags found. EXAMPLE ------- -Suppose you run 'git tag -f' and mistyped the tag to overwrite. +Suppose you run 'git tag -f' and mistype the tag to overwrite. The ref to your tag is overwritten, but until you run 'git -prune', it is still there. +prune', the tag itself is still there. ------------ $ git lost-found @@ -36,15 +35,15 @@ $ git lost-found ... ------------ -Also you can use gitk to browse how they relate to each other -and existing (probably old) tags. +Also you can use gitk to browse how any tags found relate to each +other. ------------ $ gitk $(cd .git/lost-found/commit && echo ??*) ------------ -After making sure that it is the object you are looking for, you -can reconnect it to your regular .git/refs hierarchy. +After making sure you know which the object is the tag you are looking +for, you can reconnect it to your regular .git/refs hierarchy. ------------ $ git cat-file -t 1ef2b196 diff --git a/git-rm.html b/git-rm.html index 5c56300aa..795fe544d 100644 --- a/git-rm.html +++ b/git-rm.html @@ -342,6 +342,15 @@ area (aka index).

files.

+
+--quiet +
+
+

+ git-rm normally outputs one line (in the form of an "rm" command) + for each file removed. This option suppresses that output. +

+

DISCUSSION

@@ -397,7 +406,7 @@ git-rm -f git-*.sh diff --git a/git-rm.txt b/git-rm.txt index 6feebc040..b051ccb6d 100644 --- a/git-rm.txt +++ b/git-rm.txt @@ -47,6 +47,10 @@ OPTIONS the paths only from the index, leaving working tree files. +\--quiet:: + git-rm normally outputs one line (in the form of an "rm" command) + for each file removed. This option suppresses that output. + DISCUSSION ---------- diff --git a/user-manual.html b/user-manual.html index af91bd2c8..1fd32f82e 100644 --- a/user-manual.html +++ b/user-manual.html @@ -1,4 +1,4 @@ -Git User's Manual

Git User's Manual


Table of Contents

Preface
1. Git Quick Start
Creating a new repository
Managing branches
Exploring history
Making changes
Merging
Sharing your changes
Repository maintenance
2. 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 branches from a remote repository
Naming branches, tags, and other references
Updating a repository with git fetch
Fetching branches from other repositories
3. Exploring git history
How to use bisect to find a regression
Naming commits
Creating tags
Browsing revisions
Generating diffs
Viewing old file versions
Examples
Check whether two branches point at the same history
Find first tagged version including a given fix
4. Developing with git
Telling git your name
Creating a new repository
How to make a commit
Creating good commit messages
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 editing history
Checking out an old version of a file
Ensuring good performance
Ensuring reliability
Checking the repository for corruption
Recovering lost changes
5. Sharing development with others
Getting updates with git pull
Submitting patches to a project
Importing patches to a project
Setting up a public repository
Exporting a git repository via http
Exporting a git repository via the git protocol
Pushing changes to a public repository
Setting up a shared repository
Allow web browsing of a repository
Examples
6. Rewriting history and maintaining patch series
Creating the perfect patch series
Keeping a patch series up to date using git-rebase
Modifying a single commit
Reordering or selecting from a patch series
Other tools
Problems with rewriting history
7. Advanced branch management
Fetching individual branches
Understanding git history: fast-forwards
Forcing git fetch to do non-fast-forward updates
Configuring remote branches
8. Git internals
The Object Database
Blob Object
Tree Object
Commit Object
Trust
Tag Object
The "index" aka "Current Directory Cache"
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
How git stores objects efficiently: pack files
Dangling objects
9. GIT Glossary
10. Notes and todo list for this manual

Preface

This manual is designed to be readable by someone with basic unix +Git User's Manual

Git User's Manual


Table of Contents

Preface
1. Git Quick Start
Creating a new repository
Managing branches
Exploring history
Making changes
Merging
Sharing your changes
Repository maintenance
2. 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
3. Exploring git history
How to use bisect to find a regression
Naming commits
Creating tags
Browsing revisions
Generating diffs
Viewing old file versions
Examples
Check whether two branches point at the same history
Find first tagged version including a given fix
4. Developing with git
Telling git your name
Creating a new repository
How to make a commit
Creating good commit messages
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 editing history
Checking out an old version of a file
Ensuring good performance
Ensuring reliability
Checking the repository for corruption
Recovering lost changes
5. Sharing development with others
Getting updates with git pull
Submitting patches to a project
Importing patches to a project
Setting up a public repository
Exporting a git repository via http
Exporting a git repository via the git protocol
Pushing changes to a public repository
Setting up a shared repository
Allow web browsing of a repository
Examples
6. Rewriting history and maintaining patch series
Creating the perfect patch series
Keeping a patch series up to date using git-rebase
Modifying a single commit
Reordering or selecting from a patch series
Other tools
Problems with rewriting history
7. Advanced branch management
Fetching individual branches
Understanding git history: fast-forwards
Forcing git fetch to do non-fast-forward updates
Configuring remote branches
8. Git internals
The Object Database
Blob Object
Tree Object
Commit Object
Trust
Tag Object
The "index" aka "Current Directory Cache"
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
How git stores objects efficiently: pack files
Dangling objects
9. GIT Glossary
10. Notes and todo list for this manual

Preface

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

Chapter 1 gives a brief overview of git commands, without any explanation; you may prefer to skip to chapter 2 on a first reading.

Chapters 2 and 3 explain how to fetch and study a project using git—the tools you'd need to build and test a particular version of a @@ -75,7 +75,7 @@ $ current branch:

$ git pull git://example.com/project.git theirbranch

Store the fetched branch into a local branch before merging into the current branch:

$ git pull git://example.com/project.git theirbranch:mybranch

After creating commits on a local branch, update the remote branch with your commits:

$ git push ssh://example.com/project.git mybranch:theirbranch

When remote and local branch are both named "test":

$ git push ssh://example.com/project.git test

Shortcut version for a frequently used remote repository:

$ git remote add example ssh://example.com/project.git
-$ git push example test

Repository maintenance

Check for corruption:

$ git fsck

Recompress, remove unused cruft:

$ git gc

Repository maintenance

Check for corruption:

$ git fsck

Recompress, remove unused cruft:

$ git gc

Chapter 2. Repositories and Branches

How to get a git repository

It will be useful to have a git repository to experiment with as you read this manual.

The best way to get one is by using the git-clone(1) command to download a copy of an existing repository for a project that you are interested in. If you don't already have a project in mind, here @@ -95,9 +95,9 @@ contents.

A single git repository may contain multiple branches. It keeps of them by keeping a list of heads which reference the latest version on each branch; the git-branch(1) command shows you the list of branch heads:

$ git branch
-* master

A freshly cloned repository contains a single branch head, named -"master", and working directory is initialized to the state of -the project referred to by "master".

Most projects also use tags. Tags, like heads, are +* master

A freshly cloned repository contains a single branch head, by default +named "master", with the working directory initialized to the state of +the project referred to by that branch head.

Most projects also use tags. Tags, like heads, are references into the project's history, and can be listed using the git-tag(1) command:

$ git tag -l
v2.6.11
@@ -172,7 +172,7 @@ command; running gitk now on a git repository and looking for merge commits will help understand how the git organizes history.

In the following, we say that commit X is "reachable" from commit Y if commit X is an ancestor of commit Y. Equivalently, you could say that Y is a descendent of X, or that there is a chain of parents -leading from commit Y to commit X.

Understanding history: History diagrams

We will sometimes represent git history using diagrams like the one +leading from commit Y to commit X.

Understanding history: History diagrams

We will sometimes represent git history using diagrams like the one below. Commits are shown as "o", and the links between them with lines drawn with - / and \. Time goes left to right:

         o--o--o <-- Branch A
         /
@@ -185,7 +185,7 @@ to the most recent commit on a branch.  In the example above, the branch
 head named "A" is a pointer to one particular commit, but we refer to
 the line of three commits leading up to that point as all being part of
 "branch A".

However, when no confusion will result, we often just use the term -"branch" both for branches and for branch heads.

Manipulating branches

Creating, deleting, and modifying branches is quick and easy; here's +"branch" both for branches and for branch heads.

Manipulating branches

Creating, deleting, and modifying branches is quick and easy; here's a summary of the commands:

git branch
@@ -225,8 +225,25 @@ git checkout -b <new> <start-point>
create a new branch <new> referencing <start-point>, and check it out. -

It is also useful to know that the special symbol "HEAD" can always -be used to refer to the current branch.

Examining branches from a remote repository

The "master" branch that was created at the time you cloned is a copy +

The special symbol "HEAD" can always be used to refer to the current +branch. In fact, git uses a file named "HEAD" in the .git directory to +remember which branch is current:

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

Examining an old version without creating a new branch

The git-checkout command normally expects a branch head, but will also +accept an arbitrary commit; for example, you can check out the commit +referenced by a tag:

$ git checkout v2.6.17
+Note: moving to "v2.6.17" which isn't a local branch
+If you want to create a new branch from this checkout, you may do so
+(now or later) by using -b with the checkout command again. Example:
+  git checkout -b <new_branch_name>
+HEAD is now at 427abfa... Linux v2.6.17

The HEAD then refers to the SHA1 of the commit instead of to a branch, +and git branch shows that you are no longer on a branch:

$ cat .git/HEAD
+427abfa28afedffadfca9dd8b067eb6d36bac53f
+git branch
+* (no branch)
+  master

In this case we say that the HEAD is "detached".

This can be an easy way to check out a particular version without having +to make up a name for a new branch. However, keep in mind that when you +switch away from the (for example, by checking out something else), you +can lose track of what the HEAD used to point to.

Examining branches from a remote repository

The "master" branch that was created at the time you cloned is a copy of the HEAD in the repository that you cloned from. That repository may also have had other branches, though, and your local repository keeps branches which track each of those remote branches, which you @@ -262,7 +279,7 @@ repository, creating new commits and advancing the branches to point at the new commits.

The command "git fetch", with no arguments, will update all of the remote-tracking branches to the latest version found in her repository. It will not touch any of your own branches—not even the -"master" branch that was created for you on clone.

Fetching branches from other repositories

You can also track branches from repositories other than the one you +"master" branch that was created for you on clone.

Fetching branches from other repositories

You can also track branches from repositories other than the one you cloned from, using git-remote(1):

$ git remote add linux-nfs git://linux-nfs.org/pub/nfs-2.6.git
$ git fetch linux-nfs
* refs/remotes/linux-nfs/master: storing branch 'master' ...
@@ -279,12 +296,12 @@ a new stanza:

$ ...

This is what causes git to track the remote's branches; you may modify or delete these configuration options by editing .git/config with a text editor. (See the "CONFIGURATION FILE" section of -git-config(1) for details.)

Chapter 3. Exploring git history

Git is best thought of as a tool for storing the history of a collection of files. It does this by storing compressed snapshots of the contents of a file heirarchy, together with "commits" which show the relationships between these snapshots.

Git provides extremely flexible and fast tools for exploring the history of a project.

We start with one specialized tool that is useful for finding the -commit that introduced a bug into a project.

How to use bisect to find a regression

Suppose version 2.6.18 of your project worked, but the version at +commit that introduced a bug into a project.

How to use bisect to find a regression

Suppose version 2.6.18 of your project worked, but the version at "master" crashes. Sometimes the best way to find the cause of such a regression is to perform a brute-force search through the project's history to find the particular commit that caused the problem. The @@ -312,7 +329,7 @@ occasionally you may land on a commit that broke something unrelated; run

$ git bisect visualize

which will run gitk and label the commit it chose with a marker that says "bisect". Chose a safe-looking commit nearby, note its commit id, and check it out with:

$ git reset --hard fb47ddb2db...

then test, run "bisect good" or "bisect bad" as appropriate, and -continue.

Naming commits

We have seen several ways of naming commits already:

  • +continue.

Naming commits

We have seen several ways of naming commits already:

  • 40-hexdigit object name
  • branch name: refers to the commit at the head of the given @@ -342,11 +359,11 @@ which refers to the other branch that we're merging in to the current branch.

    The git-rev-parse(1) command is a low-level command that is occasionally useful for translating some name for a commit to the object name for that commit:

    $ git rev-parse origin
    -e05db0fd4f31dde7005f075a84f96b360d05984b

Creating tags

We can also create a tag to refer to a particular commit; after +e05db0fd4f31dde7005f075a84f96b360d05984b

Creating tags

We can also create a tag to refer to a particular commit; after running

$ git tag stable-1 1b2e1d63ff

You can use stable-1 to refer to the commit 1b2e1d63ff.

This creates a "lightweight" tag. If the tag is a tag you wish to share with others, and possibly sign cryptographically, then you should create a tag object instead; see the git-tag(1) man -page for details.

Browsing revisions

The git-log(1) command can show lists of commits. On its +page for details.

Browsing revisions

The git-log(1) command can show lists of commits. On its own, it shows all commits reachable from the parent commit; but you can also make more specific requests:

$ git log v2.5..        # commits since (not reachable from) v2.5
$ git log test..master  # commits reachable from master but not test
@@ -362,15 +379,15 @@ commits since v2.5 which touch the Makefile or any file under fs:

Note that git log starts with the most recent commit and works backwards through the parents; however, since git history can contain multiple independent lines of development, the particular order that -commits are listed in may be somewhat arbitrary.

Generating diffs

You can generate diffs between any two versions using +commits are listed in may be somewhat arbitrary.

Generating diffs

You can generate diffs between any two versions using git-diff(1):

$ git diff master..test

Sometimes what you want instead is a set of patches:

$ git format-patch master..test

will generate a file with a patch for each commit reachable from test but not from master. Note that if master also has commits which are not reachable from test, then the combined result of these patches -will not be the same as the diff produced by the git-diff example.

Viewing old file versions

You can always view an old version of a file by just checking out the +will not be the same as the diff produced by the git-diff example.

Viewing old file versions

You can always view an old version of a file by just checking out the correct revision first. But sometimes it is more convenient to be able to view an old version of a single file without checking anything out; this command does that:

$ git show v2.5:fs/locks.c

Before the colon may be anything that names a commit, and after it -may be any path to a file tracked by git.

Examples

Check whether two branches point at the same history

Suppose you want to check whether two branches point at the same point +may be any path to a file tracked by git.

Examples

Check whether two branches point at the same history

Suppose you want to check whether two branches point at the same point in history.

$ git diff origin..master

will tell you whether the contents of the project are the same at the two branches; in theory, however, it's possible that the same project contents could have been arrived at by two different historical @@ -379,7 +396,7 @@ e05db0fd4f31dde7005f075a84f96b360d05984b
$ git rev-list master
e05db0fd4f31dde7005f075a84f96b360d05984b

Or you could recall that the … operator selects all commits contained reachable from either one reference or the other but not -both: so

$ git log origin...master

will return no commits when the two branches are equal.

Find first tagged version including a given fix

Suppose you know that the commit e05db0fd fixed a certain problem. +both: so

$ git log origin...master

will return no commits when the two branches are equal.

Find first tagged version including a given fix

Suppose you know that the commit e05db0fd fixed a certain problem. You'd like to find the earliest tagged release that contains that fix.

Of course, there may be more than one answer—if the history branched after commit e05db0fd, then there could be multiple "earliest" tagged @@ -406,13 +423,13 @@ available
   ! [v1.5.0-rc2] GIT v1.5.0-rc2
...

then search for a line that looks like

+ ++ [e05db0fd] Fix warnings in sha1_file.c - use C99 printf format if
available

Which shows that e05db0fd is reachable from itself, from v1.5.0-rc1, and -from v1.5.0-rc2, but not from v1.5.0-rc0.

Chapter 4. Developing with git

Telling git your name

Before creating any commits, you should introduce yourself to git. The easiest way to do so is:

$ cat >~/.gitconfig <<\EOF
[user]
        name = Your Name Comes Here
        email = you@yourdomain.example.com
EOF

(See the "CONFIGURATION FILE" section of git-config(1) for -details on the configuration file.)

Creating a new repository

Creating a new repository from scratch is very easy:

$ mkdir project
+details on the configuration file.)

Creating a new repository

Creating a new repository from scratch is very easy:

$ mkdir project
$ cd project
$ git init

If you have some initial content (say, a tarball):

$ tar -xzvf project.tar.gz
$ cd project
@@ -443,12 +460,12 @@ about to commit:

$ $ git diff          # difference between the index file and your
                    # working directory; changes that would not
                    # be included if you ran "commit" now.
-$ git status        # a brief per-file summary of the above.

Creating good commit messages

Though not required, it's a good idea to begin the commit message +$ git status        # a brief per-file summary of the above.

Creating good 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.

How to merge

You can rejoin two diverging branches of development using +body.

How to merge

You can rejoin two diverging branches of development using git-merge(1):

$ git merge branchname

merges the development in the branch "branchname" into the current branch. If there are conflicts—for example, if the same file is modified in two different ways in the remote branch and the local @@ -476,7 +493,7 @@ $ some information about the merge. Normally you can just use this default message unchanged, but you may add additional commentary of your own if desired.

The above is all you need to know to resolve a simple merge. But git -also provides more information to help resolve conflicts:

Getting conflict-resolution help during a merge

All of the changes that git was able to merge automatically are +also provides more information to help resolve conflicts:

Getting conflict-resolution help during a merge

All of the changes that git was able to merge automatically are already added to the index file, so git-diff(1) shows only the conflicts. It uses an unusual syntax:

$ git diff
diff --cc file.txt
@@ -530,7 +547,7 @@ git-diff will (by default) no longer show diffs for that file.

$ git reset --hard HEAD

Or, if you've already commited the merge that you want to throw away,

$ git reset --hard ORIG_HEAD

However, this last command can be dangerous in some cases—never throw away a commit you have already committed if that commit may itself have been merged into another branch, as doing so may confuse -further merges.

Fast-forward merges

There is one special case not mentioned above, which is treated +further merges.

Fast-forward merges

There is one special case not mentioned above, which is treated differently. Normally, a merge results in a merge commit, with two parents, one pointing at each of the two lines of development that were merged.

However, if one of the two lines of development is completely @@ -538,7 +555,7 @@ contained within the other—so every commit present in the one is already contained in the other—then git just performs a fast forward; the head of the current branch is moved forward to point at the head of the merged-in branch, without -any new commits being created.

Fixing mistakes

If you've messed up the working tree, but haven't yet committed your +any new commits being created.

Fixing mistakes

If you've messed up the working tree, but haven't yet committed your mistake, you can return the entire working tree to the last committed state with

$ git reset --hard HEAD

If you make a commit that you later wish you hadn't, there are two fundamentally different ways to fix the problem:

  1. @@ -551,7 +568,7 @@ You can go back and modify the old commit. You should git does not normally expect the "history" of a project to change, and cannot correctly perform repeated merges from a branch that has had its history changed. -

Fixing a mistake with a new commit

Creating a new commit that reverts an earlier change is very easy; +

Fixing a mistake with a new commit

Creating a new commit that reverts an earlier change is very easy; just pass the git-revert(1) command a reference to the bad commit; for example, to revert the most recent commit:

$ git revert HEAD

This will create a new commit which undoes the change in HEAD. You will be given a chance to edit the commit message for the new commit.

You can also revert an earlier change, for example, the next-to-last:

$ git revert HEAD^

In this case git will attempt to undo the old change while leaving @@ -566,17 +583,17 @@ changes, giving you a chance to edit the old commit message first.

Again, been merged into another branch; use git-revert(1) instead in that case.

It is also possible to edit commits further back in the history, but this is an advanced topic to be left for -another chapter.

Checking out an old version of a file

In the process of undoing a previous bad change, you may find it +another chapter.

Checking out an old version of a file

In the process of undoing a previous bad change, you may find it useful to check out an older version of a particular file using git-checkout(1). We've used git checkout before to switch branches, but it has quite different behavior if it is given a path name: the command

$ git checkout HEAD^ path/to/file

replaces path/to/file by the contents it had in the commit HEAD^, and also updates the index to match. It does not change branches.

If you just want to look at an old version of the file, without modifying the working directory, you can do that with -git-show(1):

$ git show HEAD^:path/to/file

which will display the given version of the file.

Ensuring good performance

On large repositories, git depends on compression to keep the history +git-show(1):

$ git show HEAD^:path/to/file

which will display the given version of the file.

Ensuring good performance

On large repositories, git depends on compression to keep the history information from taking up to much space on disk or in memory.

This compression is not performed automatically. Therefore you should occasionally run git-gc(1):

$ git gc

to recompress the archive. This can be very time-consuming, so -you may prefer to run git-gc when you are not doing other work.

Ensuring reliability

Checking the repository for corruption

The git-fsck(1) command runs a number of self-consistency checks +you may prefer to run git-gc when you are not doing other work.

Ensuring reliability

Checking the repository for corruption

The git-fsck(1) command runs a number of self-consistency checks on the repository, and reports on any problems. This may take some time. The most common warning by far is about "dangling" objects:

$ git fsck
dangling commit 7281251ddd2a61e38657c827739c57015671a6b3
@@ -591,7 +608,7 @@ dangling you can remove them at any time with git-prune(1) or the —prune option to git-gc(1):

$ git gc --prune

This may be time-consuming. Unlike most other git operations (including git-gc when run without any options), it is not safe to prune while -other git operations are in progress in the same repository.

For more about dangling objects, see the section called “Dangling objects”.

Recovering lost changes

Reflogs

Say you modify a branch with git-reset(1) —hard, and then +other git operations are in progress in the same repository.

For more about dangling objects, see the section called “Dangling objects”.

Recovering lost changes

Reflogs

Say you modify a branch with git-reset(1) —hard, and then realize that the branch was the only reference you had to that point in history.

Fortunately, git also keeps a log, called a "reflog", of all the previous values of each branch. So in this case you can still find the @@ -606,7 +623,7 @@ how to control this pruning, and see the "SPECIFYING REVISIONS" section of git-rev-parse(1) for details.

Note that the reflog history is very different from normal git history. While normal history is shared by every repository that works on the same project, the reflog history is not shared: it tells you only about -how the branches in your local repository have changed over time.

Examining dangling objects

In some situations the reflog may not be able to save you. For +how the branches in your local repository have changed over time.

Examining dangling objects

In some situations the reflog may not be able to save you. For example, suppose you delete a branch, then realize you need the history it contained. The reflog is also deleted; however, if you have not yet pruned the repository, then you may still be able to find @@ -623,7 +640,7 @@ you get exactly the history reachable from that commit that is lost. (And notice that it might not be just one commit: we only report the "tip of the line" as being dangling, but there might be a whole deep and complex commit history that was dropped.)

If you decide you want the history back, you can always create a new -reference pointing to it, for example, a new branch:

$ git branch recovered-branch 7281251ddd

Chapter 5. Sharing development with others

Getting updates with git pull

After you clone a repository and make a few changes of your own, you +reference pointing to it, for example, a new branch:

$ git branch recovered-branch 7281251ddd

Chapter 5. Sharing development with others

Getting updates with git pull

After you clone a repository and make a few changes of your own, you may wish to check the original repository for updates and merge them into your own work.

We have already seen how to keep remote tracking branches up to date with git-fetch(1), and how to merge two branches. So you can merge in changes from the @@ -640,13 +657,13 @@ repository that you pulled from.

(But note that no such commit will be cre updated to point to the latest commit from the upstream branch.)

The git-pull command can also be given "." as the "remote" repository, in which case it just merges in a branch from the current repository; so the commands

$ git pull . branch
-$ git merge branch

are roughly equivalent. The former is actually very commonly used.

Submitting patches to a project

If you just have a few changes, the simplest way to submit them may +$ git merge branch

are roughly equivalent. The former is actually very commonly used.

Submitting patches to a project

If you just have a few changes, the simplest way to submit them may just be to send them as patches in email:

First, use git-format-patch(1); for example:

$ git format-patch origin

will produce a numbered series of files in the current directory, one for each patch in the current branch but not in origin/HEAD.

You can then import these into your mail client and send them by hand. However, if you have a lot to send at once, you may prefer to use the git-send-email(1) script to automate the process. Consult the mailing list for your project first to determine how they -prefer such patches be handled.

Importing patches to a project

Git also provides a tool called git-am(1) (am stands for +prefer such patches be handled.

Importing patches to a project

Git also provides a tool called git-am(1) (am stands for "apply mailbox"), for importing such an emailed series of patches. Just save all of the patch-containing messages, in order, into a single mailbox file, say "patches.mbox", then run

$ git am -3 patches.mbox

Git will apply each patch in order; if any conflicts are found, it @@ -718,16 +735,16 @@ save typing; so, for example, after

$         url = ssh://yourserver.com/~you/proj.git
EOF

you should be able to perform the above push with just

$ git push public-repo master

See the explanations of the remote.<name>.url, branch.<name>.remote, and remote.<name>.push options in git-config(1) for -details.

Setting up a shared repository

Another way to collaborate is by using a model similar to that +details.

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 -set this up.

Allow web browsing of a repository

The gitweb cgi script provides users an easy way to browse your +set this up.

Allow web browsing of a repository

The gitweb cgi script provides users an easy way to browse your project's files and history without having to install git; see the file -gitweb/INSTALL in the git source tree for instructions on setting it up.

Examples

TODO: topic branches, typical roles as in everyday.txt, ?

Chapter 6. Rewriting history and maintaining patch series

Normally commits are only added to a project, never taken away or +gitweb/INSTALL in the git source tree for instructions on setting it up.

Examples

TODO: topic branches, typical roles as in everyday.txt, ?

Chapter 6. Rewriting history and maintaining patch series

Normally commits are only added to a project, never taken away or replaced. Git is designed with this assumption, and violating it will cause git's merge machinery (for example) to do the wrong thing.

However, there is a situation in which it can be useful to violate this -assumption.

Creating the perfect patch series

Suppose you are a contributor to a large project, and you want to add a +assumption.

Creating the perfect patch series

Suppose you are a contributor to a large project, and you want to add a complicated feature, and to present it to the other developers in a way that makes it easy for them to read your changes, verify that they are correct, and understand why you made each change.

If you present all of your changes as a single patch (or commit), they @@ -746,7 +763,7 @@ The complete series produces the same end result as your own (probably much messier!) development process did.

We will introduce some tools that can help you do this, explain how to use them, and then explain some of the problems that can arise because -you are rewriting history.

Keeping a patch series up to date using git-rebase

Suppose that you create a branch "mywork" on a remote-tracking branch +you are rewriting history.

Keeping a patch series up to date using git-rebase

Suppose that you create a branch "mywork" on a remote-tracking branch "origin", and create some commits on top of it:

$ git checkout -b mywork origin
$ vi file.txt
$ git commit
@@ -773,19 +790,19 @@ patches to the new mywork. The result will look like:

$ git rebase --continue

and git will continue applying the rest of the patches.

At any point you may use the —abort option to abort this process and -return mywork to the state it had before you started the rebase:

$ git rebase --abort

Modifying a single commit

We saw in the section called “Fixing a mistake by editing history” that you can replace the +return mywork to the state it had before you started the rebase:

$ git rebase --abort

Modifying a single commit

We saw in the section called “Fixing a mistake by editing history” that you can replace the most recent commit using

$ git commit --amend

which will replace the old commit by a new commit incorporating your changes, giving you a chance to edit the old commit message first.

You can also use a combination of this and git-rebase(1) to edit -commits further back in your history. First, tag the problematic commit with

$ git tag bad mywork~5

(Either gitk or git-log may be useful for finding the commit.)

Then check out a new branch at that commit, edit it, and rebase the rest of -the series on top of it:

$ git checkout -b TMP bad
+commits further back in your history. First, tag the problematic commit with

$ git tag bad mywork~5

(Either gitk or git-log may be useful for finding the commit.)

Then check out that commit, edit it, and rebase the rest of the series +on top of it (note that we could check out the commit on a temporary +branch, but instead we're using a detached head):

$ git checkout bad
$ # make changes here and update the index
$ git commit --amend
-$ git rebase --onto TMP bad mywork

When you're done, you'll be left with mywork checked out, with the top patches -on mywork reapplied on top of the modified commit you created in TMP. You can -then clean up with

$ git branch -d TMP
-$ git tag -d bad

Note that the immutable nature of git history means that you haven't really +$ git rebase --onto HEAD bad mywork

When you're done, you'll be left with mywork checked out, with the top +patches on mywork reapplied on top of your modified commit. You can +then clean up with

$ git tag -d bad

Note that the immutable nature of git history means that you haven't really "modified" existing commits; instead, you have replaced the old commits with -new commits having new object names.

Reordering or selecting from a patch series

Given one existing commit, the git-cherry-pick(1) command +new commits having new object names.

Reordering or selecting from a patch series

Given one existing commit, the git-cherry-pick(1) command allows you to apply the change introduced by that commit and create a new commit that records it. So, for example, if "mywork" points to a series of patches on top of "origin", you might do something like:

$ git checkout -b mywork-new origin
@@ -795,9 +812,9 @@ cherry-pick, and possibly modifying them as you go using commit —amend.

Another technique is to use git-format-patch to create a series of patches, then reset the state to before the patches:

$ git format-patch origin
$ git reset --hard origin

Then modify, reorder, or eliminate patches as preferred before applying -them again with git-am(1).

Other tools

There are numerous other tools, such as stgit, which exist for the +them again with git-am(1).

Other tools

There are numerous other tools, such as stgit, which exist for the purpose of maintaining a patch series. These are outside of the scope of -this manual.

Problems with rewriting history

The primary problem with rewriting the history of a branch has to do +this manual.

Problems with rewriting history

The primary problem with rewriting the history of a branch has to do with merging. Suppose somebody fetches your branch and merges it into their branch, with a result something like this:

 o--o--O--o--o--o <-- origin
         \        \
@@ -818,7 +835,7 @@ new.  The results are likely to be unexpected.

You may still choose to pub and it may be useful for others to be able to fetch those branches in order to examine or test them, but they should not attempt to pull such branches into their own work.

For true distributed development that supports proper merging, -published branches should never be rewritten.

Chapter 7. Advanced branch management

Fetching individual branches

Instead of using git-remote(1), you can also choose just +published branches should never be rewritten.

Chapter 7. Advanced branch management

Fetching individual branches

Instead of using git-remote(1), you can also choose just to update one branch at a time, and to store it locally under an arbitrary name:

$ git fetch origin todo:my-todo-work

The first argument, "origin", just tells git to fetch from the repository you originally cloned from. The second argument tells git @@ -842,10 +859,10 @@ resulting in a situation like:

 o--o--o--o--a--b &
 described in the following section.  However, note that in the
 situation above this may mean losing the commits labeled "a" and "b",
 unless you've already created a reference of your own pointing to
-them.

Forcing git fetch to do non-fast-forward updates

If git fetch fails because the new head of a branch is not a +them.

Forcing git fetch to do non-fast-forward updates

If git fetch fails because the new head of a branch is not a descendant of the old head, you may force the update with:

$ git fetch git://example.com/proj.git +master:refs/remotes/example/master

Note the addition of the "+" sign. Be aware that commits that the old version of example/master pointed at may be lost, as we saw in -the previous section.

Configuring remote branches

We saw above that "origin" is just a shortcut to refer to the +the previous section.

Configuring remote branches

We saw above that "origin" is just a shortcut to refer to the repository that you originally cloned from. This information is stored in git configuration variables, which you can see using git-config(1):

$ git config -l
@@ -865,8 +882,8 @@ $ throwing away commits on mybranch.

Also note that all of the above configuration can be performed by directly editing the file .git/config instead of using git-config(1).

See git-config(1) for more details on the configuration -options mentioned above.

Chapter 8. Git internals

There are two object abstractions: the "object database", and the -"current directory cache" aka "index".

The Object Database

The object database is literally just a content-addressable collection +options mentioned above.

Chapter 8. Git internals

Git depends on two fundamental abstractions: the "object database", and +the "current directory cache" aka "index".

The Object Database

The object database is literally just a content-addressable collection of objects. All objects are named by their content, which is approximated by the SHA1 hash of the object itself. Objects may refer to other objects (by referencing their SHA1 hash), and so you can @@ -874,24 +891,26 @@ build up a hierarchy of objects.

All objects have a statically determined determined at object creation time, and which identifies the format of the object (i.e. how it is used, and how it can refer to other objects). There are currently four different object types: "blob", -"tree", "commit" and "tag".

A "blob" object cannot refer to any other object, and is, like the type -implies, a pure storage object containing some user data. It is used to -actually store the file data, i.e. a blob object is associated with some -particular version of some file.

A "tree" object is an object that ties one or more "blob" objects into a -directory structure. In addition, a tree object can refer to other tree -objects, thus creating a directory hierarchy.

A "commit" object ties such directory hierarchies together into -a DAG of revisions - each "commit" is associated with exactly one tree -(the directory hierarchy at the time of the commit). In addition, a -"commit" refers to one or more "parent" commit objects that describe the -history of how we arrived at that directory hierarchy.

As a special case, a commit object with no parents is called the "root" +"tree", "commit", and "tag".

A "blob" object cannot refer to any other object, +and is, as the name implies, a pure storage object containing some +user data. It is used to actually store the file data, i.e. a blob +object is associated with some particular version of some file.

A "tree" object is an object that ties one or more +"blob" objects into a directory structure. In addition, a tree object +can refer to other tree objects, thus creating a directory hierarchy.

A "commit" object ties such directory hierarchies +together into a directed acyclic graph of revisions - each +"commit" is associated with exactly one tree (the directory hierarchy at +the time of the commit). In addition, a "commit" refers to one or more +"parent" commit objects that describe the history of how we arrived at +that directory hierarchy.

As a special case, a commit object with no parents is called the "root" object, and is the point of an initial project commit. Each project must have at least one root, and while you can tie several different root objects together into one project by creating a commit object which has two or more separate roots as its ultimate parents, that's probably just going to confuse people. So aim for the notion of "one root object -per project", even if git itself does not enforce that.

A "tag" object symbolically identifies and can be used to sign other -objects. It contains the identifier and type of another object, a -symbolic name (of course!) and, optionally, a signature.

Regardless of object type, all objects share the following +per project", even if git itself does not enforce that.

A "tag" object symbolically identifies and can be +used to sign other objects. It contains the identifier and type of +another object, a symbolic name (of course!) and, optionally, a +signature.

Regardless of object type, all objects share the following characteristics: they are all deflated with zlib, and have a header that not only specifies their type, but also provides size information about the data in the object. It's worth noting that the SHA1 hash @@ -908,7 +927,7 @@ size> + <byte\0> + <binary object data>.

The structured obj connectivity to other objects verified. This is generally done with the git-fsck program, which generates a full dependency graph of all objects, and verifies their internal consistency (in addition -to just verifying their superficial consistency through the hash).

The object types in some more detail:

Blob Object

A "blob" object is nothing but a binary blob of data, and doesn't +to just verifying their superficial consistency through the hash).

The object types in some more detail:

Blob Object

A "blob" object is nothing but a binary blob of data, and doesn't refer to anything else. There is no signature or any other verification of the data, so while the object is consistent (it is indexed by its sha1 hash, so the data itself is certainly correct), it @@ -920,7 +939,7 @@ repository) have the same contents, they will share the same blob object. The object is totally independent of its location in the directory tree, and renaming a file does not change the object that file is associated with in any way.

A blob is typically created when git-update-index(1) -is run, and its data can be accessed by git-cat-file(1).

Tree Object

The next hierarchical object type is the "tree" object. A tree object +is run, and its data can be accessed by git-cat-file(1).

Tree Object

The next hierarchical object type is the "tree" object. A tree object is a list of mode/name/blob data, sorted by name. Alternatively, the mode data may specify a directory mode, in which case instead of naming a blob, that name is associated with another TREE object.

Like the "blob" object, a tree object is uniquely determined by the @@ -944,7 +963,7 @@ involved), you can see trivial renames or permission changes by noticing that the blob stayed the same. However, renames with data changes need a smarter "diff" implementation.

A tree is created with git-write-tree(1) and its data can be accessed by git-ls-tree(1). -Two trees can be compared with git-diff-tree(1).

Commit Object

The "commit" object is an object that introduces the notion of +Two trees can be compared with git-diff-tree(1).

Commit Object

The "commit" object is an object that introduces the notion of history into the picture. In contrast to the other objects, it doesn't just describe the physical state of a tree, it describes how we got there, and why.

A "commit" is defined by the tree-object that it results in, the @@ -959,7 +978,7 @@ rename information or file mode change information. All of that is implicit in the trees involved (the result tree, and the result trees of the parents), and describing that makes no sense in this idiotic file manager.

A commit is created with git-commit-tree(1) and -its data can be accessed by git-cat-file(1).

Trust

An aside on the notion of "trust". Trust is really outside the scope +its data can be accessed by git-cat-file(1).

Trust

An aside on the notion of "trust". Trust is really outside the scope of "git", but it's worth noting a few things. First off, since everything is hashed with SHA1, you can trust that an object is intact and has not been messed with by external sources. So the name @@ -975,7 +994,7 @@ that you trust that commit, and the immutability of the history of commits tells others that they can trust the whole history.

In other words, you can easily validate a whole archive by just sending out a single email that tells the people the name (SHA1 hash) of the top commit, and digitally sign that email using something -like GPG/PGP.

To assist in this, git also provides the tag object…

Tag Object

Git provides the "tag" object to simplify creating, managing and +like GPG/PGP.

To assist in this, git also provides the tag object…

Tag Object

Git provides the "tag" object to simplify creating, managing and exchanging symbolic and signed tokens. The "tag" object at its simplest simply symbolically identifies another object by containing the sha1, type and symbolic name.

However it can optionally contain additional signature information @@ -985,7 +1004,7 @@ integrity; the trust framework (and signature provision and verification) has to come from outside.

A tag is created with git-mktag(1), its data can be accessed by git-cat-file(1), and the signature can be verified by -git-verify-tag(1).

The "index" aka "Current Directory Cache"

The index is a simple binary file, which contains an efficient +git-verify-tag(1).

The "index" aka "Current Directory Cache"

The index is a simple binary file, which contains an efficient representation of a virtual directory content at some random time. It does so by a simple array that associates a set of names, dates, permissions and content (aka "blob") objects together. The cache is @@ -1018,11 +1037,11 @@ involves a controlled modification of the index file. In particular, the index file can have the representation of an intermediate tree that has not yet been instantiated. So the index can be thought of as a write-back cache, which can contain dirty information that has not yet -been written back to the backing store.

The Workflow

Generally, all "git" operations work on the index file. Some operations +been written back to the backing store.

The Workflow

Generally, all "git" operations work on the index file. Some operations work purely on the index file (showing the current state of the index), but most operations move data to and from the index file. Either from the database or from the working directory. Thus there are four -main combinations:

working directory -> index

You update the index with information from the working directory with +main combinations:

working directory -> index

You update the index with information from the working directory with the git-update-index(1) command. You generally update the index information by just specifying the filename you want to update, like so:

$ git-update-index filename

but to avoid common mistakes with filename globbing etc, the command @@ -1038,16 +1057,16 @@ does not exist any more, it will update the index accordingly.

As a specia will refresh the "stat" information of each index to match the current stat information. It will not update the object status itself, and it will only update the fields that are used to quickly test whether -an object still matches its old backing store object.

index -> object database

You write your current index file to a "tree" object with the program

$ git-write-tree

that doesn't come with any options - it will just write out the +an object still matches its old backing store object.

index -> object database

You write your current index file to a "tree" object with the program

$ git-write-tree

that doesn't come with any options - it will just write out the current index into the set of tree objects that describe that state, and it will return the name of the resulting top-level tree. You can use that tree to re-generate the index at any time by going in the -other direction:

object database -> index

You read a "tree" file from the object database, and use that to +other direction:

object database -> index

You read a "tree" file from the object database, and use that to populate (and overwrite - don't do this if your index contains any unsaved state that you might want to restore later!) your current index. Normal operation is just

$ git-read-tree <sha1 of tree>

and your index file will now be equivalent to the tree that you saved earlier. However, that is only your index file: your working -directory contents have not been modified.

index -> working directory

You update your working directory from the index by "checking out" +directory contents have not been modified.

index -> working directory

You update your working directory from the index by "checking out" files. This is not a very common operation, since normally you'd just keep your files updated, and rather than write to your working directory, you'd tell the index files about the changes in your @@ -1058,7 +1077,7 @@ with

$ if you have an old version of the tree already checked out, you will need to use the "-f" flag (before the "-a" flag or the filename) to force the checkout.

Finally, there are a few odds and ends which are not purely moving -from one representation to the other:

Tying it all together

To commit a tree you have instantiated with "git-write-tree", you'd +from one representation to the other:

Tying it all together

To commit a tree you have instantiated with "git-write-tree", you'd create a "commit" object that refers to that tree and the history behind it - most notably the "parent" commits that preceded it in history.

Normally a "commit" has one parent: the previous state of the tree @@ -1107,7 +1126,7 @@ various pieces fit together.


                    |  Working  |
                    | Directory |
                    +-----------+
-

Examining the data

You can examine the data represented in the object database and the +

Examining the data

You can examine the data represented in the object database and the index with various helper tools. For every object, you can use git-cat-file(1) to examine details about the object:

$ git-cat-file -t <objectname>

shows the type of the object, and once you have the type (which is @@ -1117,7 +1136,7 @@ there is a special helper for showing that content, called readable form.

It's especially instructive to look at "commit" objects, since those tend to be small and fairly self-explanatory. In particular, if you follow the convention of having the top commit name in .git/HEAD, -you can do

$ git-cat-file commit HEAD

to see what the top commit was.

Merging multiple trees

Git helps you do a three-way merge, which you can expand to n-way by +you can do

$ git-cat-file commit HEAD

to see what the top commit was.

Merging multiple trees

Git helps you do a three-way merge, which you can expand to n-way by repeating the merge procedure arbitrary times until you finally "commit" the state. The normal situation is that you'd only do one three-way merge (two parents), and commit it, but if you like to, you @@ -1136,7 +1155,7 @@ make sure that you've committed those - in fact you would normally always do a merge against your last commit (which should thus match what you have in your current index anyway).

To do the merge, do

$ git-read-tree -m -u <origtree> <yourtree> <targettree>

which will do all trivial merge operations for you directly in the index file, and you can just write the result out with -git-write-tree.

Merging multiple trees, continued

Sadly, many merges aren't trivial. If there are files that have +git-write-tree.

Merging multiple trees, continued

Sadly, many merges aren't trivial. If there are files that have been added.moved or removed, or if both branches have modified the same file, you will be left with an index tree that contains "merge entries" in it. Such an index tree can NOT be written out to a tree @@ -1171,7 +1190,7 @@ that path tells git to mark the path resolved.

The above is the descriptio to help you understand what conceptually happens under the hood. In practice, nobody, not even git itself, uses three git-cat-file for this. There is git-merge-index program that extracts the -stages to temporary files and calls a "merge" script on it:

$ git-merge-index git-merge-one-file hello.c

and that is what higher level git merge -s resolve is implemented with.

How git stores objects efficiently: pack files

We've seen how git stores each object in a file named after the +stages to temporary files and calls a "merge" script on it:

$ git-merge-index git-merge-one-file hello.c

and that is what higher level git merge -s resolve is implemented with.

How git stores objects efficiently: pack files

We've seen how git stores each object in a file named after the object's SHA1 hash.

Unfortunately this system becomes inefficient once a project has a lot of objects. Try this on an old project:

$ git count-objects
6930 objects, 47620 kilobytes

The first number is the number of objects which are kept in @@ -1235,7 +1254,7 @@ on what it found, git-fsck itself is never "dangerous" to run. Running it while somebody is actually changing the repository can cause confusing and scary messages, but it won't actually do anything bad. In contrast, running "git prune" while somebody is actively changing the -repository is a BAD idea).

Chapter 9. GIT Glossary

+repository is a BAD idea).

Chapter 9. GIT Glossary

alternate object database
Via the alternates mechanism, a repository can @@ -1700,7 +1719,7 @@ repository is a BAD idea).

The set of files and directories currently being worked on, i.e. you can work in your working tree without using git at all. -

Chapter 10. Notes and todo list for this manual

This is a work in progress.

The basic requirements: +

Chapter 10. Notes and todo list for this manual

This is a work in progress.

The basic requirements: - It must be readable in order, from beginning to end, by someone intelligent with a basic grasp of the unix commandline, but without any special knowledge of git. If diff --git a/user-manual.txt b/user-manual.txt index d43d2377e..9c4c41df5 100644 --- a/user-manual.txt +++ b/user-manual.txt @@ -298,9 +298,9 @@ $ git branch * master ------------------------------------------------ -A freshly cloned repository contains a single branch head, named -"master", and working directory is initialized to the state of -the project referred to by "master". +A freshly cloned repository contains a single branch head, by default +named "master", with the working directory initialized to the state of +the project referred to by that branch head. Most projects also use <>. Tags, like heads, are references into the project's history, and can be listed using the @@ -495,8 +495,49 @@ git checkout -b :: create a new branch referencing , and check it out. -It is also useful to know that the special symbol "HEAD" can always -be used to refer to the current branch. +The special symbol "HEAD" can always be used to refer to the current +branch. In fact, git uses a file named "HEAD" in the .git directory to +remember which branch is current: + +------------------------------------------------ +$ cat .git/HEAD +ref: refs/heads/master +------------------------------------------------ + +[[detached-head]] +Examining an old version without creating a new branch +------------------------------------------------------ + +The git-checkout command normally expects a branch head, but will also +accept an arbitrary commit; for example, you can check out the commit +referenced by a tag: + +------------------------------------------------ +$ git checkout v2.6.17 +Note: moving to "v2.6.17" which isn't a local branch +If you want to create a new branch from this checkout, you may do so +(now or later) by using -b with the checkout command again. Example: + git checkout -b +HEAD is now at 427abfa... Linux v2.6.17 +------------------------------------------------ + +The HEAD then refers to the SHA1 of the commit instead of to a branch, +and git branch shows that you are no longer on a branch: + +------------------------------------------------ +$ cat .git/HEAD +427abfa28afedffadfca9dd8b067eb6d36bac53f +git branch +* (no branch) + master +------------------------------------------------ + +In this case we say that the HEAD is "detached". + +This can be an easy way to check out a particular version without having +to make up a name for a new branch. However, keep in mind that when you +switch away from the (for example, by checking out something else), you +can lose track of what the HEAD used to point to. Examining branches from a remote repository ------------------------------------------- @@ -2015,22 +2056,22 @@ $ git tag bad mywork~5 (Either gitk or git-log may be useful for finding the commit.) -Then check out a new branch at that commit, edit it, and rebase the rest of -the series on top of it: +Then check out that commit, edit it, and rebase the rest of the series +on top of it (note that we could check out the commit on a temporary +branch, but instead we're using a <>): ------------------------------------------------- -$ git checkout -b TMP bad +$ git checkout bad $ # make changes here and update the index $ git commit --amend -$ git rebase --onto TMP bad mywork +$ git rebase --onto HEAD bad mywork ------------------------------------------------- -When you're done, you'll be left with mywork checked out, with the top patches -on mywork reapplied on top of the modified commit you created in TMP. You can +When you're done, you'll be left with mywork checked out, with the top +patches on mywork reapplied on top of your modified commit. You can then clean up with ------------------------------------------------- -$ git branch -d TMP $ git tag -d bad ------------------------------------------------- @@ -2275,8 +2316,8 @@ options mentioned above. Git internals ============= -There are two object abstractions: the "object database", and the -"current directory cache" aka "index". +Git depends on two fundamental abstractions: the "object database", and +the "current directory cache" aka "index". The Object Database ------------------- @@ -2291,22 +2332,23 @@ All objects have a statically determined "type" aka "tag", which is determined at object creation time, and which identifies the format of the object (i.e. how it is used, and how it can refer to other objects). There are currently four different object types: "blob", -"tree", "commit" and "tag". +"tree", "commit", and "tag". -A "blob" object cannot refer to any other object, and is, like the type -implies, a pure storage object containing some user data. It is used to -actually store the file data, i.e. a blob object is associated with some -particular version of some file. +A <> cannot refer to any other object, +and is, as the name implies, a pure storage object containing some +user data. It is used to actually store the file data, i.e. a blob +object is associated with some particular version of some file. -A "tree" object is an object that ties one or more "blob" objects into a -directory structure. In addition, a tree object can refer to other tree -objects, thus creating a directory hierarchy. +A <> is an object that ties one or more +"blob" objects into a directory structure. In addition, a tree object +can refer to other tree objects, thus creating a directory hierarchy. -A "commit" object ties such directory hierarchies together into -a DAG of revisions - each "commit" is associated with exactly one tree -(the directory hierarchy at the time of the commit). In addition, a -"commit" refers to one or more "parent" commit objects that describe the -history of how we arrived at that directory hierarchy. +A <> ties such directory hierarchies +together into a <> of revisions - each +"commit" is associated with exactly one tree (the directory hierarchy at +the time of the commit). In addition, a "commit" refers to one or more +"parent" commit objects that describe the history of how we arrived at +that directory hierarchy. As a special case, a commit object with no parents is called the "root" object, and is the point of an initial project commit. Each project @@ -2316,9 +2358,10 @@ has two or more separate roots as its ultimate parents, that's probably just going to confuse people. So aim for the notion of "one root object per project", even if git itself does not enforce that. -A "tag" object symbolically identifies and can be used to sign other -objects. It contains the identifier and type of another object, a -symbolic name (of course!) and, optionally, a signature. +A <> symbolically identifies and can be +used to sign other objects. It contains the identifier and type of +another object, a symbolic name (of course!) and, optionally, a +signature. Regardless of object type, all objects share the following characteristics: they are all deflated with zlib, and have a header