From 67fad6d5cb982faa5da32370c961f9e00f018d2d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 6 May 2007 08:53:12 +0000 Subject: [PATCH] Autogenerated HTML docs for v1.5.2-rc2 --- RelNotes-1.5.2.txt | 2 +- diff-format.txt | 22 ++++++++++++++ git-diff-files.html | 42 +++++++++++++++++++++++++- git-diff-index.html | 42 +++++++++++++++++++++++++- git-diff-tree.html | 42 +++++++++++++++++++++++++- git-remote.html | 4 +-- git-remote.txt | 2 +- git-svn.html | 24 ++++++++++----- git-svn.txt | 35 ++++++++++------------ tutorial.html | 6 ++-- tutorial.txt | 4 +-- user-manual.html | 72 ++++++++++++++++++++++----------------------- user-manual.txt | 4 +-- 13 files changed, 224 insertions(+), 77 deletions(-) diff --git a/RelNotes-1.5.2.txt b/RelNotes-1.5.2.txt index 712ebb0b7..02b8ea0a6 100644 --- a/RelNotes-1.5.2.txt +++ b/RelNotes-1.5.2.txt @@ -171,6 +171,6 @@ this release, unless otherwise noted. -- exec >/var/tmp/1 -O=v1.5.2-rc0-106-g07c785d +O=v1.5.2-rc1-32-g125a5f1 echo O=`git describe refs/heads/master` git shortlog --no-merges $O..refs/heads/master ^refs/heads/maint diff --git a/diff-format.txt b/diff-format.txt index 378e72f38..e38a1f140 100644 --- a/diff-format.txt +++ b/diff-format.txt @@ -59,6 +59,28 @@ When `-z` option is not used, TAB, LF, and backslash characters in pathnames are represented as `\t`, `\n`, and `\\`, respectively. +diff format for merges +---------------------- + +"git-diff-tree" and "git-diff-files" can take '-c' or '--cc' option +to generate diff output also for merge commits. The output differs +from the format described above in the following way: + +. there is a colon for each parent +. there are more "src" modes and "src" sha1 +. status is concatenated status characters for each parent +. no optional "score" number +. single path, only for "dst" + +Example: + +------------------------------------------------ +::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM describe.c +------------------------------------------------ + +Note that 'combined diff' lists only files which were modified from +all parents. + Generating patches with -p -------------------------- diff --git a/git-diff-files.html b/git-diff-files.html index 716c9985e..1696cddf4 100644 --- a/git-diff-files.html +++ b/git-diff-files.html @@ -838,6 +838,46 @@ and it is out of sync with the index.

in pathnames are represented as \t, \n, and \\, respectively.

+

diff format for merges

+
+

"git-diff-tree" and "git-diff-files" can take -c or --cc option +to generate diff output also for merge commits. The output differs +from the format described above in the following way:

+
    +
  1. +

    +there is a colon for each parent +

    +
  2. +
  3. +

    +there are more "src" modes and "src" sha1 +

    +
  4. +
  5. +

    +status is concatenated status characters for each parent +

    +
  6. +
  7. +

    +no optional "score" number +

    +
  8. +
  9. +

    +single path, only for "dst" +

    +
  10. +
+

Example:

+
+
+
::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM      describe.c
+
+

Note that combined diff lists only files which were modified from +all parents.

+

Generating patches with -p

When "git-diff-index", "git-diff-tree", or "git-diff-files" are run @@ -1029,7 +1069,7 @@ two unresolved merge parents with the working tree file

diff --git a/git-diff-index.html b/git-diff-index.html index 80a38019d..513e8c136 100644 --- a/git-diff-index.html +++ b/git-diff-index.html @@ -826,6 +826,46 @@ and it is out of sync with the index.

in pathnames are represented as \t, \n, and \\, respectively.

+

diff format for merges

+
+

"git-diff-tree" and "git-diff-files" can take -c or --cc option +to generate diff output also for merge commits. The output differs +from the format described above in the following way:

+
    +
  1. +

    +there is a colon for each parent +

    +
  2. +
  3. +

    +there are more "src" modes and "src" sha1 +

    +
  4. +
  5. +

    +status is concatenated status characters for each parent +

    +
  6. +
  7. +

    +no optional "score" number +

    +
  8. +
  9. +

    +single path, only for "dst" +

    +
  10. +
+

Example:

+
+
+
::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM      describe.c
+
+

Note that combined diff lists only files which were modified from +all parents.

+

Generating patches with -p

When "git-diff-index", "git-diff-tree", or "git-diff-files" are run @@ -1111,7 +1151,7 @@ always have the special all-zero sha1.

diff --git a/git-diff-tree.html b/git-diff-tree.html index e3d8b6944..f2ba31c28 100644 --- a/git-diff-tree.html +++ b/git-diff-tree.html @@ -1277,6 +1277,46 @@ and it is out of sync with the index.

in pathnames are represented as \t, \n, and \\, respectively.

+

diff format for merges

+
+

"git-diff-tree" and "git-diff-files" can take -c or --cc option +to generate diff output also for merge commits. The output differs +from the format described above in the following way:

+
    +
  1. +

    +there is a colon for each parent +

    +
  2. +
  3. +

    +there are more "src" modes and "src" sha1 +

    +
  4. +
  5. +

    +status is concatenated status characters for each parent +

    +
  6. +
  7. +

    +no optional "score" number +

    +
  8. +
  9. +

    +single path, only for "dst" +

    +
  10. +
+

Example:

+
+
+
::100644 100644 100644 fabadb8... cc95eb0... 4866510... MM      describe.c
+
+

Note that combined diff lists only files which were modified from +all parents.

+

Generating patches with -p

When "git-diff-index", "git-diff-tree", or "git-diff-files" are run @@ -1468,7 +1508,7 @@ two unresolved merge parents with the working tree file

diff --git a/git-remote.html b/git-remote.html index bf2d3f150..6d157b54a 100644 --- a/git-remote.html +++ b/git-remote.html @@ -303,7 +303,7 @@ the remote information is set up.

refspec for the remote to track all branches under $GIT_DIR/remotes/<name>/, a refspec to track only <branch> is created. You can give more than one -t <branch> to track -multiple branche without grabbing all branches.

+multiple branches without grabbing all branches.

With -m <master> option, $GIT_DIR/remotes/<name>/HEAD is set up to point at remote's <master> branch instead of whatever branch the HEAD at the remote repository actually points at.

@@ -410,7 +410,7 @@ $ git merge origin diff --git a/git-remote.txt b/git-remote.txt index a9fb6a9a5..3dde7134a 100644 --- a/git-remote.txt +++ b/git-remote.txt @@ -40,7 +40,7 @@ With `-t ` option, instead of the default glob refspec for the remote to track all branches under `$GIT_DIR/remotes//`, a refspec to track only `` is created. You can give more than one `-t ` to track -multiple branche without grabbing all branches. +multiple branches without grabbing all branches. + With `-m ` option, `$GIT_DIR/remotes//HEAD` is set up to point at remote's `` branch instead of whatever diff --git a/git-svn.html b/git-svn.html index 8f0acbeab..72e459bc1 100644 --- a/git-svn.html +++ b/git-svn.html @@ -304,7 +304,7 @@ branches, tags directories).

argument. Normally this command initializes the current directory.

- +
-T<trunk_subdir>
@@ -388,6 +388,8 @@ branches, tags directories).

repository.

+
+
fetch
@@ -431,9 +433,6 @@ accepts. However --fetch-all only fetches from the current [svn-remote], and not all [svn-remote] definitions.

Like git-rebase; this requires that the working tree be clean and have no uncommitted changes.

-

+

- -
-l @@ -448,8 +447,7 @@ and have no uncommitted changes.

-

+

-
+
dcommit
@@ -465,8 +463,18 @@ and have no uncommitted changes.

An optional command-line argument may be specified as an alternative to HEAD. This is advantageous over set-tree (below) because it produces - cleaner, more linear history. + cleaner, more linear history.

+
+
+--no-rebase +
+
+

+ After committing, do not rebase or reset. +

+
+
@@ -995,7 +1003,7 @@ should be manually entered with a text-editor or using diff --git a/git-svn.txt b/git-svn.txt index 62d7ef8be..c0d7d9597 100644 --- a/git-svn.txt +++ b/git-svn.txt @@ -38,32 +38,30 @@ COMMANDS argument. Normally this command initializes the current directory. --T:: ---trunk=:: --t:: ---tags=:: --b:: ---branches=:: +-T;; +--trunk=;; +-t;; +--tags=;; +-b;; +--branches=;; These are optional command-line options for init. Each of these flags can point to a relative repository path (--tags=project/tags') or a full url (--tags=https://foo.org/project/tags) - ---no-metadata:: +--no-metadata;; Set the 'noMetadata' option in the [svn-remote] config. ---use-svm-props:: +--use-svm-props;; Set the 'useSvmProps' option in the [svn-remote] config. ---use-svnsync-props:: +--use-svnsync-props;; Set the 'useSvnsyncProps' option in the [svn-remote] config. ---rewrite-root=:: +--rewrite-root=;; Set the 'rewriteRoot' option in the [svn-remote] config. ---username=:: +--username=;; For transports that SVN handles authentication for (http, https, and plain svn), specify the username. For other transports (eg svn+ssh://), you must include the username in the URL, eg svn+ssh://foo@svn.bar.com/project - ---prefix=:: +--prefix=;; This allows one to specify a prefix which is prepended to the names of remotes if trunk/branches/tags are specified. The prefix does not automatically include a @@ -73,7 +71,6 @@ COMMANDS repository. 'fetch':: - Fetch unfetched revisions from the Subversion remote we are tracking. The name of the [svn-remote "..."] section in the .git/config file may be specified as an optional command-line @@ -104,14 +101,11 @@ accepts. However '--fetch-all' only fetches from the current Like 'git-rebase'; this requires that the working tree be clean and have no uncommitted changes. -+ --- + -l;; --local;; Do not fetch remotely; only run 'git-rebase' against the last fetched commit from the upstream SVN. --- -+ 'dcommit':: Commit each diff from a specified head directly to the SVN @@ -125,6 +119,9 @@ and have no uncommitted changes. alternative to HEAD. This is advantageous over 'set-tree' (below) because it produces cleaner, more linear history. ++ +--no-rebase;; + After committing, do not rebase or reset. -- 'log':: diff --git a/tutorial.html b/tutorial.html index 8d47b3def..52df2bdb3 100644 --- a/tutorial.html +++ b/tutorial.html @@ -255,11 +255,11 @@ div.exampleblock-content { padding-left: 0.5em; } -A tutorial introduction to git +A tutorial introduction to git (for version 1.5.1 or newer)
@@ -781,7 +781,7 @@ digressions that may be interesting at this point are:

diff --git a/tutorial.txt b/tutorial.txt index e978562d6..99efce457 100644 --- a/tutorial.txt +++ b/tutorial.txt @@ -1,5 +1,5 @@ -A tutorial introduction to git -============================== +A tutorial introduction to git (for version 1.5.1 or newer) +=========================================================== This tutorial explains how to import a new project into git, make changes to it, and share changes with other developers. diff --git a/user-manual.html b/user-manual.html index 1fd32f82e..489debf16 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 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 +Git User's Manual (for version 1.5.1 or newer)

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


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 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
@@ -35,7 +35,7 @@ $   Tracked remote branches
    master next ...
$ git fetch example             # update branches from example
-$ git branch -r                 # list all remote branches

Exploring history

$ gitk                      # visualize and browse history
+$ git branch -r                 # list all remote branches

Exploring history

$ gitk                      # visualize and browse history
$ git log                   # list all commits
$ git log src/              # ...modifying src/
$ git log v2.6.15..v2.6.16  # ...in v2.6.16, not in v2.6.15
@@ -66,7 +66,7 @@ commit:

$ $ git add b.txt    # new file
$ git rm c.txt     # old file
$ git commit

Or, prepare and create the commit in one step:

$ git commit d.txt # use latest content only of d.txt
-$ git commit -a    # use latest content of all tracked files

Merging

$ git merge test   # merge branch "test" into the current branch
+$ git commit -a    # use latest content of all tracked files

Merging

$ git merge test   # merge branch "test" into the current branch
$ git pull git://example.com/project.git master
                   # fetch and merge in remote branch
$ git pull . test  # equivalent to git merge test

Sharing your changes

Importing or exporting patches:

$ git format-patch origin..HEAD # format a patch for each commit
@@ -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 @@ -88,7 +88,7 @@ will only need to clone once.

The clone command creates a new directory na directory, you will see that it contains a copy of the project files, together with a special top-level directory named ".git", which contains all the information about the history of the project.

In most of the following, examples will be taken from one of the two -repositories above.

How to check out a different version of a project

Git is best thought of as a tool for storing the history of a +repositories above.

How to check out a different version of a project

Git is best thought of as a tool for storing the history of a collection of files. It stores the history as a compressed collection of interrelated snapshots (versions) of the project's contents.

A single git repository may contain multiple branches. It keeps track @@ -119,7 +119,7 @@ branches, with an asterisk marking the currently checked-out branch:

$ git reset --hard v2.6.17

Note that if the current branch head was your only reference to a particular point in history, then resetting that branch may leave you with no way to find the history it used to point to; so use this command -carefully.

Understanding History: Commits

Every change in the history of a project is represented by a commit. +carefully.

Understanding History: Commits

Every change in the history of a project is represented by a commit. The git-show(1) command shows the most recent commit on the current branch:

$ git show
commit 2b5f6dcce5bf94b9b119e9ed8d537098ec61c3d2
@@ -179,7 +179,7 @@ lines drawn with - / and \. Time goes left to right:

Understanding history: What is a branch?

When we need to be precise, we will use the word "branch" to mean a line +be replaced with another letter or number.

Understanding history: What is a branch?

When we need to be precise, we will use the word "branch" to mean a line of development, and "branch head" (or just "head") to mean a reference 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 @@ -296,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 @@ -387,7 +387,7 @@ will not be the same as the diff produced by the git-diff example.

$ 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 @@ -396,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 @@ -423,7 +423,7 @@ 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
@@ -547,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 @@ -583,7 +583,7 @@ 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 @@ -593,7 +593,7 @@ 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 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
@@ -640,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 @@ -657,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 @@ -735,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 @@ -763,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
@@ -790,7 +790,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

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 that commit, edit it, and rebase the rest of the series @@ -802,7 +802,7 @@ $ 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
@@ -812,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
         \        \
@@ -835,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 @@ -859,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
@@ -882,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

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 +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 @@ -927,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 @@ -939,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 @@ -994,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 diff --git a/user-manual.txt b/user-manual.txt index 9c4c41df5..dff438f76 100644 --- a/user-manual.txt +++ b/user-manual.txt @@ -1,5 +1,5 @@ -Git User's Manual -_________________ +Git User's Manual (for version 1.5.1 or newer) +______________________________________________ This manual is designed to be readable by someone with basic unix command-line skills, but no previous knowledge of git. -- 2.26.2