From: Junio C Hamano Date: Wed, 28 Feb 2007 08:13:52 +0000 (+0000) Subject: Autogenerated HTML docs for v1.5.0.2-230-gfbe3d X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=db911ee731950adff42ed5f6bec37c095e6f16a3;p=git.git Autogenerated HTML docs for v1.5.0.2-230-gfbe3d --- diff --git a/git-cvsimport.html b/git-cvsimport.html index 6cb109f91..508da8853 100644 --- a/git-cvsimport.html +++ b/git-cvsimport.html @@ -432,16 +432,6 @@ the old cvs2git tool.

--A <author-conv-file> -
-
-

- CVS by default uses the Unix username when writing its - commit logs. Using this option and an author-conv-file - in this format -

-
-
-a
@@ -467,26 +457,32 @@ the old cvs2git tool.

cvsimport leaks memory.

- -

+

+
+-A <author-conv-file> +
+
+

+ CVS by default uses the Unix username when writing its + commit logs. Using this option and an author-conv-file + in this format +

        exon=Andreas Ericsson <ae@op5.se>
         spawn=Simon Pawn <spawn@frog-pond.org>
 
-

+ -git-cvsimport will make it appear as those authors had +

git-cvsimport will make it appear as those authors had their GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL set properly all along.

-

+ -For convenience, this data is saved to $GIT_DIR/cvs-authors +

For convenience, this data is saved to $GIT_DIR/cvs-authors each time the -A option is provided and read from that same file each time git-cvsimport is run.

-

+ -It is not recommended to use this feature if you intend to +

It is not recommended to use this feature if you intend to export changes back to CVS again later with git-cvsexportcommit(1).

+
+

OUTPUT

@@ -509,7 +505,7 @@ various participants of the git-list <git@vger.kernel.org>.

diff --git a/git-cvsimport.txt b/git-cvsimport.txt index f5450de74..0d59c0613 100644 --- a/git-cvsimport.txt +++ b/git-cvsimport.txt @@ -96,11 +96,6 @@ If you need to pass multiple options, separate them with a comma. -s :: Substitute the character "/" in branch names with --A :: - CVS by default uses the Unix username when writing its - commit logs. Using this option and an author-conv-file - in this format - -a:: Import all commits, including recent ones. cvsimport by default skips commits that have a timestamp less than 10 minutes ago. @@ -112,6 +107,10 @@ If you need to pass multiple options, separate them with a comma. Limit the number of commits imported. Workaround for cases where cvsimport leaks memory. +-A :: + CVS by default uses the Unix username when writing its + commit logs. Using this option and an author-conv-file + in this format + --------- exon=Andreas Ericsson diff --git a/git-diff-files.html b/git-diff-files.html index 655fa2794..d6b3575a3 100644 --- a/git-diff-files.html +++ b/git-diff-files.html @@ -272,7 +272,7 @@ git-diff-files(1) Manual Page

SYNOPSIS

-

git-diff-files [-q] [-0|-1|-2|-3|-c|--cc] [<common diff options>] [<path>…]

+

git-diff-files [-q] [-0|-1|-2|-3|-c|--cc|-n|--no-index] [<common diff options>] [<path>…]

DESCRIPTION

@@ -664,6 +664,14 @@ omit diff output for unmerged entries and just show "Unmerged".

+\-n,--no-index +
+
+

+ Compare the two given files / directories. +

+
+
-q
@@ -1003,7 +1011,7 @@ two unresolved merge parents with the working tree file
diff --git a/git-diff-files.txt b/git-diff-files.txt index 7248b35d9..b78c4c64f 100644 --- a/git-diff-files.txt +++ b/git-diff-files.txt @@ -8,7 +8,7 @@ git-diff-files - Compares files in the working tree and the index SYNOPSIS -------- -'git-diff-files' [-q] [-0|-1|-2|-3|-c|--cc] [] [...] +'git-diff-files' [-q] [-0|-1|-2|-3|-c|--cc|-n|--no-index] [] [...] DESCRIPTION ----------- @@ -36,6 +36,9 @@ omit diff output for unmerged entries and just show "Unmerged". diff, similar to the way 'diff-tree' shows a merge commit with these flags. +\-n,\--no-index:: + Compare the two given files / directories. + -q:: Remain silent even on nonexistent files diff --git a/git-diff.html b/git-diff.html index 580b20405..0a45472fa 100644 --- a/git-diff.html +++ b/git-diff.html @@ -290,6 +290,12 @@ tree and the index file, or the index file and the working tree.

further add to the index but you still haven't. You can stage these changes by using git-add(1).

+
+
+
If exactly two paths are given, and at least one is untracked,
+compare the two files / directories. This behavior can be
+forced by --no-index.
+
git-diff [--options] --cached [<commit>] [--] [<path>…] @@ -836,7 +842,7 @@ output diff in reverse. diff --git a/git-diff.txt b/git-diff.txt index 6a098df26..12a531d1e 100644 --- a/git-diff.txt +++ b/git-diff.txt @@ -23,6 +23,10 @@ tree and the index file, or the index file and the working tree. further add to the index but you still haven't. You can stage these changes by using gitlink:git-add[1]. + If exactly two paths are given, and at least one is untracked, + compare the two files / directories. This behavior can be + forced by --no-index. + 'git-diff' [--options] --cached [] [--] [...]:: This form is to view the changes you staged for the next diff --git a/git-show.html b/git-show.html index 7dacc95df..b6d7badef 100644 --- a/git-show.html +++ b/git-show.html @@ -458,21 +458,33 @@ git show v1.0.0

- +git show v1.0.0^{tree}

Shows the tree pointed to by the tag v1.0.0.

- -

git show next~10:Documentation/README +

+git show next~10:Documentation/README +
+
+

Shows the contents of the file Documentation/README as they were current in the 10th last commit of the branch - next.

-

git show master:Makefile master:t/Makefile + next. +

+
+
+git show master:Makefile master:t/Makefile +
+
+

Concatenates the contents of said Makefiles in the head - of the branch master.

+ of the branch master. +

+
+

Discussion

@@ -566,7 +578,7 @@ Johannes Schindelin <Johannes.Schindelin@gmx.de>.

diff --git a/git-show.txt b/git-show.txt index f56f16498..5a219ab57 100644 --- a/git-show.txt +++ b/git-show.txt @@ -48,15 +48,15 @@ git show v1.0.0:: Shows the tag `v1.0.0`, along with the object the tags points at. -git show v1.0.0^{tree}:: +git show v1.0.0^\{tree\}:: Shows the tree pointed to by the tag `v1.0.0`. -git show next~10:Documentation/README +git show next~10:Documentation/README:: Shows the contents of the file `Documentation/README` as they were current in the 10th last commit of the branch `next`. -git show master:Makefile master:t/Makefile +git show master:Makefile master:t/Makefile:: Concatenates the contents of said Makefiles in the head of the branch `master`. diff --git a/git.html b/git.html index 6bb8b417e..bbf659d1a 100644 --- a/git.html +++ b/git.html @@ -2290,7 +2290,7 @@ contributors on the git-list <git@vger.kernel.org>.

diff --git a/user-manual.html b/user-manual.html index 2a8863daa..105fc591c 100644 --- a/user-manual.html +++ b/user-manual.html @@ -1,10 +1,10 @@ -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
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
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. Glossary of git terms
10. Notes and todo list for this manual

Preface

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

Chapter 1 gives a brief overview of git commands, without any +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
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
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. Glossary of git terms
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 software project, to search for regressions, and so on.

Chapter 4 explains how to do development with git, and chapter 5 how to share that development with others.

Further chapters cover more specialized topics.

Comprehensive reference documentation is available through the man -pages. For a command such as "git clone", just use

$ man git-clone

Chapter 1. Git Quick Start

This is a quick summary of the major commands; the following chapters +pages. For a command such as "git clone", just use

$ man git-clone

Chapter 1. Git Quick Start

This is a quick summary of the major commands; the following chapters will explain how these work in more detail.

Creating a new repository

From a tarball:

$ tar xzf project.tar.gz
$ cd project
$ git init
@@ -57,7 +57,7 @@ Bisecting:                                 # test here, then:
$ git bisect good               # if this revision is good, or
$ git bisect bad                # if this revision is bad.
-                                # repeat until done.

Making changes

Make sure git knows who to blame:

$ cat >~/.gitconfig <<\EOF
+                                # repeat until done.

Making changes

Make sure git knows who to blame:

$ cat >~/.gitconfig <<\EOF
[user]
name = Your Name Comes Here
email = you@yourdomain.example.com
@@ -276,7 +276,7 @@ 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 @@ -376,7 +376,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 @@ -403,13 +403,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
@@ -486,7 +486,7 @@ index conflict will have two parents instead of the usual one: one parent will be HEAD, the tip of the current branch; the other will be the tip of the other branch, which is stored temporarily in MERGE_HEAD.

The diff above shows the differences between the working-tree version -of file.txt and two previous version: one version from HEAD, and one +of file.txt and two previous versions: one version from HEAD, and one from MERGE_HEAD. So instead of preceding each line by a single "+" or "-", it now uses two columns: the first column is used for differences between the first parent and the working directory copy, @@ -519,7 +519,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. @@ -532,7 +532,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 @@ -572,7 +572,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 @@ -587,9 +587,9 @@ 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 pointed you. The reflog is also deleted; however, if you have not +it contained. The reflog is also deleted; however, if you have not yet pruned the repository, then you may still be able to find the lost commits; run git-fsck and watch for output that mentions "dangling commits":

$ git fsck
@@ -603,7 +603,7 @@ history that is described by all your existing branches and tags. Thus 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 gotten dropped.)

If you decide you want the history back, you can always create a new +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 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), @@ -618,7 +618,7 @@ how to control these defaults depending on the current branch.

In addition producing a default commit message documenting the branch and repository that you pulled from.

(But note that no such commit will be created in the case of a fast forward; instead, your branch will just be -updated to point to the latest commit from the upstream branch).

The git-pull command can also be given "." as the "remote" repository, +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 @@ -642,8 +642,8 @@ taken from the message containing each patch.

Getting updates with git pull".

If you and maintainer both have accounts on the same machine, then then you can just pull changes from each other's repositories -directly; note that all of the command (git-clone(1), -git-fetch[1], git-pull[1], etc.) which accept a URL as an argument +directly; note that all of the commands (git-clone(1), +git-fetch[1], git-pull[1], etc.) that accept a URL as an argument will also accept a local file patch; so, for example, you can use

$ git clone /path/to/repository
$ git pull /path/to/other/repository

If this sort of setup is inconvenient or impossible, another (more @@ -705,14 +705,14 @@ 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 project's files and history without having to install git; see the file -gitweb/README 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/README 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 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 -may find it is too much to digest all at once.

If you present them with the entire history of your work, complete with +may find that it is too much to digest all at once.

If you present them with the entire history of your work, complete with mistakes, corrections, and dead ends, they may be overwhelmed.

So the ideal is usually to produce a series of patches such that:

  1. Each patch can be applied in order.
  2. @@ -727,9 +727,8 @@ 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 you have a series of commits in a branch "mywork", which -originally branched off from "origin".

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

$ git checkout -b mywork origin
+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
$ vi otherfile.txt
@@ -751,7 +750,7 @@ 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

Reordering or selecting from a patch series

Given one existing commit, the git-cherry-pick(1) command +return mywork to the state it had before you started the rebase:

$ git rebase --abort

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
@@ -761,9 +760,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 -purpose of maintaining a patch series. These are out of the scope of -this manual.

Problems with rewriting history

The primary problem with rewriting the history of a branch has to do +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 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
        \                 t--t--t--m <-- their branch:

Then suppose you modify the last three commits:

        o--o--o <-- new head of origin
@@ -782,7 +781,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 @@ -804,11 +803,11 @@ resulting in a situation like:

o--o--o--o--a--b &l
 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 -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 which the +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 -repository which you originally cloned from. This information is +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
core.repositoryformatversion=0
@@ -827,8 +826,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

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 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 @@ -870,7 +869,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 @@ -882,7 +881,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 @@ -906,7 +905,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 @@ -921,7 +920,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 @@ -937,7 +936,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 @@ -947,7 +946,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 @@ -969,7 +968,7 @@ cached state ("tree object waiting to be instantiated") and the current state.

(c) it can additionally efficiently represent information about merge conflicts between different tree objects, allowing each pathname to be associated with sufficient information about the trees involved that -you can create a three-way merge between them.

Those are the three ONLY things that the directory cache does. It's a +you can create a three-way merge between them.

Those are the ONLY three things that the directory cache does. It's a cache, and the normal operation is to re-generate it completely from a known tree object, or update/compare it with a live tree that is being developed. If you blow the directory cache away entirely, you generally @@ -980,11 +979,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 @@ -1000,16 +999,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 @@ -1020,7 +1019,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 @@ -1069,7 +1068,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 @@ -1079,7 +1078,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 @@ -1098,7 +1097,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 @@ -1133,7 +1132,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 @@ -1197,7 +1196,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. Glossary of git terms

+repository is a BAD idea).

Chapter 9. Glossary of git terms

alternate object database
Via the alternates mechanism, a repository can inherit part of its @@ -1620,7 +1619,7 @@ working tree
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 03736bbcd..34e965104 100644 --- a/user-manual.txt +++ b/user-manual.txt @@ -2,7 +2,7 @@ Git User's Manual _________________ This manual is designed to be readable by someone with basic unix -commandline skills, but no previous knowledge of git. +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. @@ -1196,7 +1196,7 @@ will be HEAD, the tip of the current branch; the other will be the tip of the other branch, which is stored temporarily in MERGE_HEAD. The diff above shows the differences between the working-tree version -of file.txt and two previous version: one version from HEAD, and one +of file.txt and two previous versions: one version from HEAD, and one from MERGE_HEAD. So instead of preceding each line by a single "+" or "-", it now uses two columns: the first column is used for differences between the first parent and the working directory copy, @@ -1479,7 +1479,7 @@ 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 pointed you. The reflog is also deleted; however, if you have not +it contained. The reflog is also deleted; however, if you have not yet pruned the repository, then you may still be able to find the lost commits; run git-fsck and watch for output that mentions "dangling commits": @@ -1505,7 +1505,7 @@ history that is described by all your existing branches and tags. Thus 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 gotten dropped.) +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: @@ -1561,7 +1561,7 @@ repository that you pulled from. (But note that no such commit will be created in the case of a <>; instead, your branch will just be -updated to point to the latest commit from the upstream branch). +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 @@ -1638,8 +1638,8 @@ updates with git pull>>". If you and maintainer both have accounts on the same machine, then then you can just pull changes from each other's repositories -directly; note that all of the command (gitlink:git-clone[1], -git-fetch[1], git-pull[1], etc.) which accept a URL as an argument +directly; note that all of the commands (gitlink:git-clone[1], +git-fetch[1], git-pull[1], etc.) that accept a URL as an argument will also accept a local file patch; so, for example, you can use @@ -1832,7 +1832,7 @@ 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 -may find it is too much to digest all at once. +may find that it is too much to digest all at once. If you present them with the entire history of your work, complete with mistakes, corrections, and dead ends, they may be overwhelmed. @@ -1858,11 +1858,8 @@ you are rewriting history. Keeping a patch series up to date using git-rebase -------------------------------------------------- -Suppose you have a series of commits in a branch "mywork", which -originally branched off from "origin". - -Suppose you create a branch "mywork" on a remote-tracking branch -"origin", and created some commits on top of it: +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 @@ -1966,7 +1963,7 @@ Other tools ----------- There are numerous other tools, such as stgit, which exist for the -purpose of maintaining a patch series. These are out of the scope of +purpose of maintaining a patch series. These are outside of the scope of this manual. Problems with rewriting history @@ -2088,7 +2085,7 @@ 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 which the +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. @@ -2096,7 +2093,7 @@ Configuring remote branches --------------------------- We saw above that "origin" is just a shortcut to refer to the -repository which you originally cloned from. This information is +repository that you originally cloned from. This information is stored in git configuration variables, which you can see using gitlink:git-config[1]: @@ -2407,7 +2404,7 @@ conflicts between different tree objects, allowing each pathname to be associated with sufficient information about the trees involved that you can create a three-way merge between them.' -Those are the three ONLY things that the directory cache does. It's a +Those are the ONLY three things that the directory cache does. It's a cache, and the normal operation is to re-generate it completely from a known tree object, or update/compare it with a live tree that is being developed. If you blow the directory cache away entirely, you generally