From: Junio C Hamano Date: Tue, 8 Jul 2008 07:19:17 +0000 (-0700) Subject: Merge branch 'lt/racy-empty' into maint X-Git-Tag: v1.5.6.3~11 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/c636d0e2bcffdbd55c096944561d9ac470da600e?hp=f49c2c22fef520fd69ff26869c26dc58a834de2c Merge branch 'lt/racy-empty' into maint * lt/racy-empty: racy-git: an empty blob has a fixed object name --- diff --git a/Documentation/.gitignore b/Documentation/.gitignore index 2f938f471a..d8edd90406 100644 --- a/Documentation/.gitignore +++ b/Documentation/.gitignore @@ -2,7 +2,9 @@ *.html *.[1-8] *.made +*.texi git.info +gitman.info howto-index.txt doc.dep cmds-*.txt diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 994eb9159a..d2a0a76e6c 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -89,6 +89,8 @@ For C programs: of "else if" statements, it can make sense to add braces to single line blocks. + - We try to avoid assignments inside if(). + - Try to make your code understandable. You may put comments in, but comments invariably tend to stale out when the code they were describing changes. Often splitting a function diff --git a/Documentation/Makefile b/Documentation/Makefile index 43781fb248..62269e39c4 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -1,9 +1,12 @@ MAN1_TXT= \ $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \ $(wildcard git-*.txt)) \ - gitk.txt -MAN5_TXT=gitattributes.txt gitignore.txt gitcli.txt gitmodules.txt -MAN7_TXT=git.txt + gitk.txt git.txt +MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \ + gitrepository-layout.txt +MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \ + gitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt \ + gitdiffcore.txt MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT) MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT)) @@ -11,17 +14,9 @@ MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT)) DOC_HTML=$(MAN_HTML) -ARTICLES = tutorial -ARTICLES += tutorial-2 -ARTICLES += core-tutorial -ARTICLES += cvs-migration -ARTICLES += diffcore -ARTICLES += howto-index -ARTICLES += repository-layout -ARTICLES += hooks +ARTICLES = howto-index ARTICLES += everyday ARTICLES += git-tools -ARTICLES += glossary # with their own formatting rules. SP_ARTICLES = howto/revert-branch-rebase howto/using-merge-subtree user-manual API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt))) @@ -144,8 +139,6 @@ cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT) $(PERL_PATH) ./cmd-list.perl ../command-list.txt date >$@ -git.7 git.html: git.txt - clean: $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 $(RM) *.texi *.texi+ git.info gitman.info diff --git a/Documentation/RelNotes-1.5.4.6.txt b/Documentation/RelNotes-1.5.4.6.txt new file mode 100644 index 0000000000..3e3c3e55a3 --- /dev/null +++ b/Documentation/RelNotes-1.5.4.6.txt @@ -0,0 +1,43 @@ +GIT v1.5.4.6 Release Notes +========================== + +I personally do not think there is any reason anybody should want to +run v1.5.4.X series these days, because 'master' version is always +more stable than any tagged released version of git. + +This is primarily to futureproof "git-shell" to accept requests +without a dash between "git" and subcommand name (e.g. "git +upload-pack") which the newer client will start to make sometime in +the future. + +Fixes since v1.5.4.5 +-------------------- + + * Command line option "-n" to "git-repack" was not correctly parsed. + + * Error messages from "git-apply" when the patchfile cannot be opened + have been improved. + + * Error messages from "git-bisect" when given nonsense revisions have + been improved. + + * reflog syntax that uses time e.g. "HEAD@{10 seconds ago}:path" did not + stop parsing at the closing "}". + + * "git rev-parse --symbolic-full-name ^master^2" printed solitary "^", + but it should print nothing. + + * "git apply" did not enforce "match at the beginning" correctly. + + * a path specification "a/b" in .gitattributes file should not match + "sub/a/b", but it did. + + * "git log --date-order --topo-order" did not override the earlier + date-order with topo-order as expected. + + * "git fast-export" did not export octopus merges correctly. + + * "git archive --prefix=$path/" mishandled gitattributes. + +As usual, it also comes with many documentation fixes and clarifications. + diff --git a/Documentation/RelNotes-1.5.5.5.txt b/Documentation/RelNotes-1.5.5.5.txt new file mode 100644 index 0000000000..30fa3615c7 --- /dev/null +++ b/Documentation/RelNotes-1.5.5.5.txt @@ -0,0 +1,11 @@ +GIT v1.5.5.5 Release Notes +========================== + +I personally do not think there is any reason anybody should want to +run v1.5.5.X series these days, because 'master' version is always +more stable than any tagged released version of git. + +This is primarily to futureproof "git-shell" to accept requests +without a dash between "git" and subcommand name (e.g. "git +upload-pack") which the newer client will start to make sometime in +the future. diff --git a/Documentation/RelNotes-1.5.6.1.txt b/Documentation/RelNotes-1.5.6.1.txt new file mode 100644 index 0000000000..4864b16445 --- /dev/null +++ b/Documentation/RelNotes-1.5.6.1.txt @@ -0,0 +1,28 @@ +GIT v1.5.6.1 Release Notes +========================== + +Fixes since v1.5.6 +------------------ + +* Last minute change broke loose object creation on AIX. + +* (performance fix) We used to make $GIT_DIR absolute path early in the + programs but keeping it relative to the current directory internally + gives 1-3 per-cent performance boost. + +* bash completion knows the new --graph option to git-log family. + + +* git-diff -c/--cc showed unnecessary "deletion" lines at the context + boundary. + +* git-for-each-ref ignored %(object) and %(type) requests for tag + objects. + +* git-merge usage had a typo. + +* Rebuilding of git-svn metainfo database did not take rewriteRoot + option into account. + +* Running "git-rebase --continue/--skip/--abort" before starting a + rebase gave nonsense error messages. diff --git a/Documentation/RelNotes-1.5.6.2.txt b/Documentation/RelNotes-1.5.6.2.txt new file mode 100644 index 0000000000..5902a85a78 --- /dev/null +++ b/Documentation/RelNotes-1.5.6.2.txt @@ -0,0 +1,40 @@ +GIT v1.5.6.2 Release Notes +========================== + +Futureproof +----------- + + * "git-shell" accepts requests without a dash between "git" and + subcommand name (e.g. "git upload-pack") which the newer client will + start to make sometime in the future. + +Fixes since v1.5.6.1 +-------------------- + +* "git clone" from a remote that is named with url.insteadOf setting in + $HOME/.gitconfig did not work well. + +* "git describe --long --tags" segfaulted when the described revision was + tagged with a lightweight tag. + +* "git diff --check" did not report the result via its exit status + reliably. + +* When remote side used to have branch 'foo' and git-fetch finds that now + it has branch 'foo/bar', it refuses to lose the existing remote tracking + branch and its reflog. The error message has been improved to suggest + pruning the remote if the user wants to proceed and get the latest set + of branches from the remote, including such 'foo/bar'. + +* "git reset file" should mean the same thing as "git reset HEAD file", + but we required disambiguating -- even when "file" is not ambiguous. + +* "git show" segfaulted when an annotated tag that points at another + annotated tag was given to it. + +* Optimization for a large import via "git-svn" introduced in v1.5.6 had a + serious memory and temporary file leak, which made it unusable for + moderately large import. + +* "git-svn" mangled remote nickname used in the configuration file + unnecessarily. diff --git a/Documentation/RelNotes-1.5.6.txt b/Documentation/RelNotes-1.5.6.txt new file mode 100644 index 0000000000..e143d8d61b --- /dev/null +++ b/Documentation/RelNotes-1.5.6.txt @@ -0,0 +1,115 @@ +GIT v1.5.6 Release Notes +======================== + +Updates since v1.5.5 +-------------------- + +(subsystems) + +* Comes with updated gitk and git-gui. + +(portability) + +* git will build on AIX better than before now. + +* core.ignorecase configuration variable can be used to work better on + filesystems that are not case sensitive. + +* "git init" now autodetects the case sensitivity of the filesystem and + sets core.ignorecase accordingly. + +* cpio is no longer used; neither "curl" binary (libcurl is still used). + +(documentation) + +* Many freestanding documentation pages have been converted and made + available to "git help" (aka "man git") as section 7 of + the manual pages. This means bookmarks to some HTML documentation + files may need to be updated (eg "tutorial.html" became + "gittutorial.html"). + +(performance) + +* "git clone" was rewritten in C. This will hopefully help cloning a + repository with insane number of refs. + +* "git rebase --onto $there $from $branch" used to switch to the tip of + $branch only to immediately reset back to $from, smudging work tree + files unnecessarily. This has been optimized. + +* Object creation codepath in "git-svn" has been optimized by enhancing + plumbing commands git-cat-file and git-hash-object. + +(usability, bells and whistles) + +* "git add -p" (and the "patch" subcommand of "git add -i") can choose to + apply (or not apply) mode changes independently from contents changes. + +* "git bisect help" gives longer and more helpful usage information. + +* "git bisect" does not use a special branch "bisect" anymore; instead, it + does its work on a detached HEAD. + +* "git branch" (and "git checkout -b") can be told to set up + branch..rebase automatically, so that later you can say "git pull" + and magically cause "git pull --rebase" to happen. + +* "git branch --merged" and "git branch --no-merged" can be used to list + branches that have already been merged (or not yet merged) to the + current branch. + +* "git cherry-pick" and "git revert" can add a sign-off. + +* "git commit" mentions the author identity when you are committing + somebody else's changes. + +* "git diff/log --dirstat" output is consistent between binary and textual + changes. + +* "git filter-branch" rewrites signed tags by demoting them to annotated. + +* "git format-patch --no-binary" can produce a patch that lack binary + changes (i.e. cannot be used to propagate the whole changes) meant only + for reviewing. + +* "git init --bare" is a synonym for "git --bare init" now. + +* "git gc --auto" honors a new pre-auto-gc hook to temporarily disable it. + +* "git log --pretty=tformat:" gives a LF after each entry, + instead of giving a LF between each pair of entries which is how + "git log --pretty=format:" works. + +* "git log" and friends learned the "--graph" option to show the ancestry + graph at the left margin of the output. + +* "git log" and friends can be told to use date format that is different + from the default via 'log.date' configuration variable. + +* "git send-email" now can send out messages outside a git repository. + +* "git send-email --compose" was made aware of rfc2047 quoting. + +* "git status" can optionally include output from "git submodule + summary". + +* "git svn" learned --add-author-from option to propagate the authorship + by munging the commit log message. + +* new object creation and looking up in "git svn" has been optimized. + +* "gitweb" can read from a system-wide configuration file. + +(internal) + +* "git unpack-objects" and "git receive-pack" is now more strict about + detecting breakage in the objects they receive over the wire. + + +Fixes since v1.5.5 +------------------ + +All of the fixes in v1.5.5 maintenance series are included in +this release, unless otherwise noted. + +And there are too numerous small fixes to otherwise note here ;-) diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt index c11bb7d36c..5428111d73 100644 --- a/Documentation/blame-options.txt +++ b/Documentation/blame-options.txt @@ -41,7 +41,8 @@ of lines before or after the line given by . -S :: Use revs from revs-file instead of calling linkgit:git-rev-list[1]. --p, --porcelain:: +-p:: +--porcelain:: Show in a format designed for machine consumption. --incremental:: @@ -83,5 +84,6 @@ alphanumeric characters that git must detect as moving between files for it to associate those lines with the parent commit. --h, --help:: +-h:: +--help:: Show help message. diff --git a/Documentation/cat-texi.perl b/Documentation/cat-texi.perl index e3d8e9faa8..dbc133cd3c 100755 --- a/Documentation/cat-texi.perl +++ b/Documentation/cat-texi.perl @@ -11,7 +11,7 @@ if (s/^\@top (.*)/\@node $1,,,Top/) { push @menu, $1; } - s/\(\@pxref{\[URLS\]}\)//; + s/\(\@pxref{\[(URLS|REMOTES)\]}\)//; print TMP; } close TMP; diff --git a/Documentation/config.txt b/Documentation/config.txt index 273b358069..5331b450ea 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -205,10 +205,13 @@ Can be overridden by the 'GIT_PROXY_COMMAND' environment variable handling). core.ignoreStat:: - The working copy files are assumed to stay unchanged until you - mark them otherwise manually - Git will not detect the file changes - by lstat() calls. This is useful on systems where those are very - slow, such as Microsoft Windows. See linkgit:git-update-index[1]. + If true, commands which modify both the working tree and the index + will mark the updated paths with the "assume unchanged" bit in the + index. These marked files are then assumed to stay unchanged in the + working copy, until you mark them otherwise manually - Git will not + detect the file changes by lstat() calls. This is useful on systems + where those are very slow, such as Microsoft Windows. + See linkgit:git-update-index[1]. False by default. core.preferSymlinkRefs:: @@ -234,7 +237,13 @@ core.worktree:: used in combination with repositories found automatically in a .git directory (i.e. $GIT_DIR is not set). This can be overridden by the GIT_WORK_TREE environment - variable and the '--work-tree' command line option. + variable and the '--work-tree' command line option. It can be + a absolute path or relative path to the directory specified by + --git-dir or GIT_DIR. + Note: If --git-dir or GIT_DIR are specified but none of + --work-tree, GIT_WORK_TREE and core.worktree is specified, + the current working directory is regarded as the top directory + of your working tree. core.logAllRefUpdates:: Enable the reflog. Updates to a ref is logged to the file @@ -261,7 +270,12 @@ core.sharedRepository:: group-writable). When 'all' (or 'world' or 'everybody'), the repository will be readable by all users, additionally to being group-shareable. When 'umask' (or 'false'), git will use permissions - reported by umask(2). See linkgit:git-init[1]. False by default. + reported by umask(2). When '0xxx', where '0xxx' is an octal number, + files in the repository will have this mode value. '0xxx' will override + user's umask value, and thus, users with a safe umask (0077) can use + this option. Examples: '0660' is equivalent to 'group'. '0640' is a + repository that is group-readable but not group-writable. + See linkgit:git-init[1]. False by default. core.warnAmbiguousRefs:: If true, git will warn you if the ref name you passed it is ambiguous @@ -388,6 +402,21 @@ branch.autosetupmerge:: done when the starting point is either a local branch or remote branch. This option defaults to true. +branch.autosetuprebase:: + When a new branch is created with `git-branch` or `git-checkout` + that tracks another branch, this variable tells git to set + up pull to rebase instead of merge (see "branch..rebase"). + When `never`, rebase is never automatically set to true. + When `local`, rebase is set to true for tracked branches of + other local branches. + When `remote`, rebase is set to true for tracked branches of + remote branches. + When `always`, rebase will be set to true for all tracking + branches. + See "branch.autosetupmerge" for details on how to set up a + branch to track another branch. + This option defaults to never. + branch..remote:: When in branch , it tells `git fetch` which remote to fetch. If this option is not given, `git fetch` defaults to remote "origin". @@ -497,8 +526,10 @@ color.status.:: one of `header` (the header text of the status message), `added` or `updated` (files which are added but not committed), `changed` (files which are changed but not added in the index), - or `untracked` (files which are not tracked by git). The values of - these variables may be specified as in color.branch.. + `untracked` (files which are not tracked by git), or + `nobranch` (the color the 'no branch' warning is shown in, defaulting + to red). The values of these variables may be specified as in + color.branch.. commit.template:: Specify a file to use as the template for new commit messages. @@ -634,11 +665,24 @@ gitcvs.logfile:: Path to a log file where the CVS server interface well... logs various stuff. See linkgit:git-cvsserver[1]. +gitcvs.usecrlfattr + If true, the server will look up the `crlf` attribute for + files to determine the '-k' modes to use. If `crlf` is set, + the '-k' mode will be left blank, so cvs clients will + treat it as text. If `crlf` is explicitly unset, the file + will be set with '-kb' mode, which supresses any newline munging + the client might otherwise do. If `crlf` is not specified, + then 'gitcvs.allbinary' is used. See linkgit:gitattribute[5]. + gitcvs.allbinary:: - If true, all files are sent to the client in mode '-kb'. This - causes the client to treat all files as binary files which suppresses - any newline munging it otherwise might do. A work-around for the - fact that there is no way yet to set single files to mode '-kb'. + This is used if 'gitcvs.usecrlfattr' does not resolve + the correct '-kb' mode to use. If true, all + unresolved files are sent to the client in + mode '-kb'. This causes the client to treat them + as binary files, which suppresses any newline munging it + otherwise might do. Alternatively, if it is set to "guess", + then the contents of the file are examined to decide if + it is binary, similar to 'core.autocrlf'. gitcvs.dbname:: Database used by git-cvsserver to cache revision information @@ -669,11 +713,42 @@ gitcvs.dbTableNamePrefix:: linkgit:git-cvsserver[1] for details). Any non-alphabetic characters will be replaced with underscores. -All gitcvs variables except for 'gitcvs.allbinary' can also be -specified as 'gitcvs..' (where 'access_method' +All gitcvs variables except for 'gitcvs.usecrlfattr' and +'gitcvs.allbinary' can also be specified as +'gitcvs..' (where 'access_method' is one of "ext" and "pserver") to make them apply only for the given access method. +gui.commitmsgwidth:: + Defines how wide the commit message window is in the + linkgit:git-gui[1]. "75" is the default. + +gui.diffcontext:: + Specifies how many context lines should be used in calls to diff + made by the linkgit:git-gui[1]. The default is "5". + +gui.matchtrackingbranch:: + Determines if new branches created with linkgit:git-gui[1] should + default to tracking remote branches with matching names or + not. Default: "false". + +gui.newbranchtemplate:: + Is used as suggested name when creating new branches using the + linkgit:git-gui[1]. + +gui.pruneduringfetch:: + "true" if linkgit:git-gui[1] should prune tracking branches when + performing a fetch. The default value is "false". + +gui.trustmtime:: + Determines if linkgit:git-gui[1] should trust the file modification + timestamp or not. By default the timestamps are not trusted. + +gui.spellingdictionary:: + Specifies the dictionary used for spell checking commit messages in + the linkgit:git-gui[1]. When set to "none" spell checking is turned + off. + help.browser:: Specify the browser that will be used to display help in the 'web' format. See linkgit:git-help[1]. @@ -759,6 +834,12 @@ instaweb.port:: The port number to bind the gitweb httpd to. See linkgit:git-instaweb[1]. +log.date:: + Set default date-time mode for the log command. Setting log.date + value is similar to using git log's --date option. The value is one of + following alternatives: {relative,local,default,iso,rfc,short}. + See linkgit:git-log[1]. + log.showroot:: If true, the initial commit will be shown as a big creation event. This is equivalent to a diff against an empty tree. @@ -769,37 +850,16 @@ man.viewer:: Specify the programs that may be used to display help in the 'man' format. See linkgit:git-help[1]. -merge.summary:: - Whether to include summaries of merged commits in newly created - merge commit messages. False by default. - -merge.tool:: - Controls which merge resolution program is used by - linkgit:git-mergetool[1]. Valid built-in values are: "kdiff3", - "tkdiff", "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff", and - "opendiff". Any other value is treated is custom merge tool - and there must be a corresponing mergetool..cmd option. - -merge.verbosity:: - Controls the amount of output shown by the recursive merge - strategy. Level 0 outputs nothing except a final error - message if conflicts were detected. Level 1 outputs only - conflicts, 2 outputs conflicts and file changes. Level 5 and - above outputs debugging information. The default is level 2. - Can be overridden by 'GIT_MERGE_VERBOSITY' environment variable. - -merge..name:: - Defines a human readable name for a custom low-level - merge driver. See linkgit:gitattributes[5] for details. - -merge..driver:: - Defines the command that implements a custom low-level - merge driver. See linkgit:gitattributes[5] for details. - -merge..recursive:: - Names a low-level merge driver to be used when - performing an internal merge between common ancestors. - See linkgit:gitattributes[5] for details. +include::merge-config.txt[] + +man..cmd:: + Specify the command to invoke the specified man viewer. The + specified command is evaluated in shell with the man page + passed as argument. (See linkgit:git-help[1].) + +man..path:: + Override the path for the given tool that may be used to + display help in the 'man' format. See linkgit:git-help[1]. mergetool..path:: Override the path for the given tool. This is useful in case @@ -911,6 +971,10 @@ remote..push:: The default set of "refspec" for linkgit:git-push[1]. See linkgit:git-push[1]. +remote..mirror:: + If true, pushing to this remote will automatically behave + as if the `\--mirror` option was given on the command line. + remote..skipDefaultUpdate:: If true, this remote will be skipped by default when updating using the update subcommand of linkgit:git-remote[1]. @@ -992,6 +1056,12 @@ imap:: The configuration variables in the 'imap' section are described in linkgit:git-imap-send[1]. +receive.fsckObjects:: + If it is set to true, git-receive-pack will check all received + objects. It will abort in the case of a malformed object or a + broken link. The result of an abort are only dangling objects. + Defaults to false. + receive.unpackLimit:: If the number of objects received in a push is below this limit then the objects will be unpacked into loose object diff --git a/Documentation/core-tutorial.txt b/Documentation/core-tutorial.txt deleted file mode 100644 index 5a5531222d..0000000000 --- a/Documentation/core-tutorial.txt +++ /dev/null @@ -1,1681 +0,0 @@ -A git core tutorial for developers -================================== - -Introduction ------------- - -This tutorial explains how to use the "core" git programs to set up and -work with a git repository. - -If you just need to use git as a revision control system you may prefer -to start with link:tutorial.html[a tutorial introduction to git] or -link:user-manual.html[the git user manual]. - -However, an understanding of these low-level tools can be helpful if -you want to understand git's internals. - -The core git is often called "plumbing", with the prettier user -interfaces on top of it called "porcelain". You may not want to use the -plumbing directly very often, but it can be good to know what the -plumbing does for when the porcelain isn't flushing. - -[NOTE] -Deeper technical details are often marked as Notes, which you can -skip on your first reading. - - -Creating a git repository -------------------------- - -Creating a new git repository couldn't be easier: all git repositories start -out empty, and the only thing you need to do is find yourself a -subdirectory that you want to use as a working tree - either an empty -one for a totally new project, or an existing working tree that you want -to import into git. - -For our first example, we're going to start a totally new repository from -scratch, with no pre-existing files, and we'll call it `git-tutorial`. -To start up, create a subdirectory for it, change into that -subdirectory, and initialize the git infrastructure with `git-init`: - ------------------------------------------------- -$ mkdir git-tutorial -$ cd git-tutorial -$ git-init ------------------------------------------------- - -to which git will reply - ----------------- -Initialized empty Git repository in .git/ ----------------- - -which is just git's way of saying that you haven't been doing anything -strange, and that it will have created a local `.git` directory setup for -your new project. You will now have a `.git` directory, and you can -inspect that with `ls`. For your new empty project, it should show you -three entries, among other things: - - - a file called `HEAD`, that has `ref: refs/heads/master` in it. - This is similar to a symbolic link and points at - `refs/heads/master` relative to the `HEAD` file. -+ -Don't worry about the fact that the file that the `HEAD` link points to -doesn't even exist yet -- you haven't created the commit that will -start your `HEAD` development branch yet. - - - a subdirectory called `objects`, which will contain all the - objects of your project. You should never have any real reason to - look at the objects directly, but you might want to know that these - objects are what contains all the real 'data' in your repository. - - - a subdirectory called `refs`, which contains references to objects. - -In particular, the `refs` subdirectory will contain two other -subdirectories, named `heads` and `tags` respectively. They do -exactly what their names imply: they contain references to any number -of different 'heads' of development (aka 'branches'), and to any -'tags' that you have created to name specific versions in your -repository. - -One note: the special `master` head is the default branch, which is -why the `.git/HEAD` file was created points to it even if it -doesn't yet exist. Basically, the `HEAD` link is supposed to always -point to the branch you are working on right now, and you always -start out expecting to work on the `master` branch. - -However, this is only a convention, and you can name your branches -anything you want, and don't have to ever even 'have' a `master` -branch. A number of the git tools will assume that `.git/HEAD` is -valid, though. - -[NOTE] -An 'object' is identified by its 160-bit SHA1 hash, aka 'object name', -and a reference to an object is always the 40-byte hex -representation of that SHA1 name. The files in the `refs` -subdirectory are expected to contain these hex references -(usually with a final `\'\n\'` at the end), and you should thus -expect to see a number of 41-byte files containing these -references in these `refs` subdirectories when you actually start -populating your tree. - -[NOTE] -An advanced user may want to take a look at the -link:repository-layout.html[repository layout] document -after finishing this tutorial. - -You have now created your first git repository. Of course, since it's -empty, that's not very useful, so let's start populating it with data. - - -Populating a git repository ---------------------------- - -We'll keep this simple and stupid, so we'll start off with populating a -few trivial files just to get a feel for it. - -Start off with just creating any random files that you want to maintain -in your git repository. We'll start off with a few bad examples, just to -get a feel for how this works: - ------------------------------------------------- -$ echo "Hello World" >hello -$ echo "Silly example" >example ------------------------------------------------- - -you have now created two files in your working tree (aka 'working directory'), -but to actually check in your hard work, you will have to go through two steps: - - - fill in the 'index' file (aka 'cache') with the information about your - working tree state. - - - commit that index file as an object. - -The first step is trivial: when you want to tell git about any changes -to your working tree, you use the `git-update-index` program. That -program normally just takes a list of filenames you want to update, but -to avoid trivial mistakes, it refuses to add new entries to the index -(or remove existing ones) unless you explicitly tell it that you're -adding a new entry with the `\--add` flag (or removing an entry with the -`\--remove`) flag. - -So to populate the index with the two files you just created, you can do - ------------------------------------------------- -$ git-update-index --add hello example ------------------------------------------------- - -and you have now told git to track those two files. - -In fact, as you did that, if you now look into your object directory, -you'll notice that git will have added two new objects to the object -database. If you did exactly the steps above, you should now be able to do - - ----------------- -$ ls .git/objects/??/* ----------------- - -and see two files: - ----------------- -.git/objects/55/7db03de997c86a4a028e1ebd3a1ceb225be238 -.git/objects/f2/4c74a2e500f5ee1332c86b94199f52b1d1d962 ----------------- - -which correspond with the objects with names of `557db...` and -`f24c7...` respectively. - -If you want to, you can use `git-cat-file` to look at those objects, but -you'll have to use the object name, not the filename of the object: - ----------------- -$ git-cat-file -t 557db03de997c86a4a028e1ebd3a1ceb225be238 ----------------- - -where the `-t` tells `git-cat-file` to tell you what the "type" of the -object is. git will tell you that you have a "blob" object (i.e., just a -regular file), and you can see the contents with - ----------------- -$ git-cat-file "blob" 557db03 ----------------- - -which will print out "Hello World". The object `557db03` is nothing -more than the contents of your file `hello`. - -[NOTE] -Don't confuse that object with the file `hello` itself. The -object is literally just those specific *contents* of the file, and -however much you later change the contents in file `hello`, the object -we just looked at will never change. Objects are immutable. - -[NOTE] -The second example demonstrates that you can -abbreviate the object name to only the first several -hexadecimal digits in most places. - -Anyway, as we mentioned previously, you normally never actually take a -look at the objects themselves, and typing long 40-character hex -names is not something you'd normally want to do. The above digression -was just to show that `git-update-index` did something magical, and -actually saved away the contents of your files into the git object -database. - -Updating the index did something else too: it created a `.git/index` -file. This is the index that describes your current working tree, and -something you should be very aware of. Again, you normally never worry -about the index file itself, but you should be aware of the fact that -you have not actually really "checked in" your files into git so far, -you've only *told* git about them. - -However, since git knows about them, you can now start using some of the -most basic git commands to manipulate the files or look at their status. - -In particular, let's not even check in the two files into git yet, we'll -start off by adding another line to `hello` first: - ------------------------------------------------- -$ echo "It's a new day for git" >>hello ------------------------------------------------- - -and you can now, since you told git about the previous state of `hello`, ask -git what has changed in the tree compared to your old index, using the -`git-diff-files` command: - ------------- -$ git-diff-files ------------- - -Oops. That wasn't very readable. It just spit out its own internal -version of a `diff`, but that internal version really just tells you -that it has noticed that "hello" has been modified, and that the old object -contents it had have been replaced with something else. - -To make it readable, we can tell git-diff-files to output the -differences as a patch, using the `-p` flag: - ------------- -$ git-diff-files -p -diff --git a/hello b/hello -index 557db03..263414f 100644 ---- a/hello -+++ b/hello -@@ -1 +1,2 @@ - Hello World -+It's a new day for git ----- - -i.e. the diff of the change we caused by adding another line to `hello`. - -In other words, `git-diff-files` always shows us the difference between -what is recorded in the index, and what is currently in the working -tree. That's very useful. - -A common shorthand for `git-diff-files -p` is to just write `git -diff`, which will do the same thing. - ------------- -$ git diff -diff --git a/hello b/hello -index 557db03..263414f 100644 ---- a/hello -+++ b/hello -@@ -1 +1,2 @@ - Hello World -+It's a new day for git ------------- - - -Committing git state --------------------- - -Now, we want to go to the next stage in git, which is to take the files -that git knows about in the index, and commit them as a real tree. We do -that in two phases: creating a 'tree' object, and committing that 'tree' -object as a 'commit' object together with an explanation of what the -tree was all about, along with information of how we came to that state. - -Creating a tree object is trivial, and is done with `git-write-tree`. -There are no options or other input: git-write-tree will take the -current index state, and write an object that describes that whole -index. In other words, we're now tying together all the different -filenames with their contents (and their permissions), and we're -creating the equivalent of a git "directory" object: - ------------------------------------------------- -$ git-write-tree ------------------------------------------------- - -and this will just output the name of the resulting tree, in this case -(if you have done exactly as I've described) it should be - ----------------- -8988da15d077d4829fc51d8544c097def6644dbb ----------------- - -which is another incomprehensible object name. Again, if you want to, -you can use `git-cat-file -t 8988d\...` to see that this time the object -is not a "blob" object, but a "tree" object (you can also use -`git-cat-file` to actually output the raw object contents, but you'll see -mainly a binary mess, so that's less interesting). - -However -- normally you'd never use `git-write-tree` on its own, because -normally you always commit a tree into a commit object using the -`git-commit-tree` command. In fact, it's easier to not actually use -`git-write-tree` on its own at all, but to just pass its result in as an -argument to `git-commit-tree`. - -`git-commit-tree` normally takes several arguments -- it wants to know -what the 'parent' of a commit was, but since this is the first commit -ever in this new repository, and it has no parents, we only need to pass in -the object name of the tree. However, `git-commit-tree` also wants to get a -commit message on its standard input, and it will write out the resulting -object name for the commit to its standard output. - -And this is where we create the `.git/refs/heads/master` file -which is pointed at by `HEAD`. This file is supposed to contain -the reference to the top-of-tree of the master branch, and since -that's exactly what `git-commit-tree` spits out, we can do this -all with a sequence of simple shell commands: - ------------------------------------------------- -$ tree=$(git-write-tree) -$ commit=$(echo 'Initial commit' | git-commit-tree $tree) -$ git-update-ref HEAD $commit ------------------------------------------------- - -In this case this creates a totally new commit that is not related to -anything else. Normally you do this only *once* for a project ever, and -all later commits will be parented on top of an earlier commit. - -Again, normally you'd never actually do this by hand. There is a -helpful script called `git commit` that will do all of this for you. So -you could have just written `git commit` -instead, and it would have done the above magic scripting for you. - - -Making a change ---------------- - -Remember how we did the `git-update-index` on file `hello` and then we -changed `hello` afterward, and could compare the new state of `hello` with the -state we saved in the index file? - -Further, remember how I said that `git-write-tree` writes the contents -of the *index* file to the tree, and thus what we just committed was in -fact the *original* contents of the file `hello`, not the new ones. We did -that on purpose, to show the difference between the index state, and the -state in the working tree, and how they don't have to match, even -when we commit things. - -As before, if we do `git-diff-files -p` in our git-tutorial project, -we'll still see the same difference we saw last time: the index file -hasn't changed by the act of committing anything. However, now that we -have committed something, we can also learn to use a new command: -`git-diff-index`. - -Unlike `git-diff-files`, which showed the difference between the index -file and the working tree, `git-diff-index` shows the differences -between a committed *tree* and either the index file or the working -tree. In other words, `git-diff-index` wants a tree to be diffed -against, and before we did the commit, we couldn't do that, because we -didn't have anything to diff against. - -But now we can do - ----------------- -$ git-diff-index -p HEAD ----------------- - -(where `-p` has the same meaning as it did in `git-diff-files`), and it -will show us the same difference, but for a totally different reason. -Now we're comparing the working tree not against the index file, -but against the tree we just wrote. It just so happens that those two -are obviously the same, so we get the same result. - -Again, because this is a common operation, you can also just shorthand -it with - ----------------- -$ git diff HEAD ----------------- - -which ends up doing the above for you. - -In other words, `git-diff-index` normally compares a tree against the -working tree, but when given the `\--cached` flag, it is told to -instead compare against just the index cache contents, and ignore the -current working tree state entirely. Since we just wrote the index -file to HEAD, doing `git-diff-index \--cached -p HEAD` should thus return -an empty set of differences, and that's exactly what it does. - -[NOTE] -================ -`git-diff-index` really always uses the index for its -comparisons, and saying that it compares a tree against the working -tree is thus not strictly accurate. In particular, the list of -files to compare (the "meta-data") *always* comes from the index file, -regardless of whether the `\--cached` flag is used or not. The `\--cached` -flag really only determines whether the file *contents* to be compared -come from the working tree or not. - -This is not hard to understand, as soon as you realize that git simply -never knows (or cares) about files that it is not told about -explicitly. git will never go *looking* for files to compare, it -expects you to tell it what the files are, and that's what the index -is there for. -================ - -However, our next step is to commit the *change* we did, and again, to -understand what's going on, keep in mind the difference between "working -tree contents", "index file" and "committed tree". We have changes -in the working tree that we want to commit, and we always have to -work through the index file, so the first thing we need to do is to -update the index cache: - ------------------------------------------------- -$ git-update-index hello ------------------------------------------------- - -(note how we didn't need the `\--add` flag this time, since git knew -about the file already). - -Note what happens to the different `git-diff-\*` versions here. After -we've updated `hello` in the index, `git-diff-files -p` now shows no -differences, but `git-diff-index -p HEAD` still *does* show that the -current state is different from the state we committed. In fact, now -`git-diff-index` shows the same difference whether we use the `--cached` -flag or not, since now the index is coherent with the working tree. - -Now, since we've updated `hello` in the index, we can commit the new -version. We could do it by writing the tree by hand again, and -committing the tree (this time we'd have to use the `-p HEAD` flag to -tell commit that the HEAD was the *parent* of the new commit, and that -this wasn't an initial commit any more), but you've done that once -already, so let's just use the helpful script this time: - ------------------------------------------------- -$ git commit ------------------------------------------------- - -which starts an editor for you to write the commit message and tells you -a bit about what you have done. - -Write whatever message you want, and all the lines that start with '#' -will be pruned out, and the rest will be used as the commit message for -the change. If you decide you don't want to commit anything after all at -this point (you can continue to edit things and update the index), you -can just leave an empty message. Otherwise `git commit` will commit -the change for you. - -You've now made your first real git commit. And if you're interested in -looking at what `git commit` really does, feel free to investigate: -it's a few very simple shell scripts to generate the helpful (?) commit -message headers, and a few one-liners that actually do the -commit itself (`git-commit`). - - -Inspecting Changes ------------------- - -While creating changes is useful, it's even more useful if you can tell -later what changed. The most useful command for this is another of the -`diff` family, namely `git-diff-tree`. - -`git-diff-tree` can be given two arbitrary trees, and it will tell you the -differences between them. Perhaps even more commonly, though, you can -give it just a single commit object, and it will figure out the parent -of that commit itself, and show the difference directly. Thus, to get -the same diff that we've already seen several times, we can now do - ----------------- -$ git-diff-tree -p HEAD ----------------- - -(again, `-p` means to show the difference as a human-readable patch), -and it will show what the last commit (in `HEAD`) actually changed. - -[NOTE] -============ -Here is an ASCII art by Jon Loeliger that illustrates how -various diff-\* commands compare things. - - diff-tree - +----+ - | | - | | - V V - +-----------+ - | Object DB | - | Backing | - | Store | - +-----------+ - ^ ^ - | | - | | diff-index --cached - | | - diff-index | V - | +-----------+ - | | Index | - | | "cache" | - | +-----------+ - | ^ - | | - | | diff-files - | | - V V - +-----------+ - | Working | - | Directory | - +-----------+ -============ - -More interestingly, you can also give `git-diff-tree` the `--pretty` flag, -which tells it to also show the commit message and author and date of the -commit, and you can tell it to show a whole series of diffs. -Alternatively, you can tell it to be "silent", and not show the diffs at -all, but just show the actual commit message. - -In fact, together with the `git-rev-list` program (which generates a -list of revisions), `git-diff-tree` ends up being a veritable fount of -changes. A trivial (but very useful) script called `git-whatchanged` is -included with git which does exactly this, and shows a log of recent -activities. - -To see the whole history of our pitiful little git-tutorial project, you -can do - ----------------- -$ git log ----------------- - -which shows just the log messages, or if we want to see the log together -with the associated patches use the more complex (and much more -powerful) - ----------------- -$ git-whatchanged -p ----------------- - -and you will see exactly what has changed in the repository over its -short history. - -[NOTE] -When using the above two commands, the initial commit will be shown. -If this is a problem because it is huge, you can hide it by setting -the log.showroot configuration variable to false. Having this, you -can still show it for each command just adding the `\--root` option, -which is a flag for `git-diff-tree` accepted by both commands. - -With that, you should now be having some inkling of what git does, and -can explore on your own. - -[NOTE] -Most likely, you are not directly using the core -git Plumbing commands, but using Porcelain such as `git-add`, `git-rm' -and `git-commit'. - - -Tagging a version ------------------ - -In git, there are two kinds of tags, a "light" one, and an "annotated tag". - -A "light" tag is technically nothing more than a branch, except we put -it in the `.git/refs/tags/` subdirectory instead of calling it a `head`. -So the simplest form of tag involves nothing more than - ------------------------------------------------- -$ git tag my-first-tag ------------------------------------------------- - -which just writes the current `HEAD` into the `.git/refs/tags/my-first-tag` -file, after which point you can then use this symbolic name for that -particular state. You can, for example, do - ----------------- -$ git diff my-first-tag ----------------- - -to diff your current state against that tag which at this point will -obviously be an empty diff, but if you continue to develop and commit -stuff, you can use your tag as an "anchor-point" to see what has changed -since you tagged it. - -An "annotated tag" is actually a real git object, and contains not only a -pointer to the state you want to tag, but also a small tag name and -message, along with optionally a PGP signature that says that yes, -you really did -that tag. You create these annotated tags with either the `-a` or -`-s` flag to `git tag`: - ----------------- -$ git tag -s ----------------- - -which will sign the current `HEAD` (but you can also give it another -argument that specifies the thing to tag, i.e., you could have tagged the -current `mybranch` point by using `git tag mybranch`). - -You normally only do signed tags for major releases or things -like that, while the light-weight tags are useful for any marking you -want to do -- any time you decide that you want to remember a certain -point, just create a private tag for it, and you have a nice symbolic -name for the state at that point. - - -Copying repositories --------------------- - -git repositories are normally totally self-sufficient and relocatable. -Unlike CVS, for example, there is no separate notion of -"repository" and "working tree". A git repository normally *is* the -working tree, with the local git information hidden in the `.git` -subdirectory. There is nothing else. What you see is what you got. - -[NOTE] -You can tell git to split the git internal information from -the directory that it tracks, but we'll ignore that for now: it's not -how normal projects work, and it's really only meant for special uses. -So the mental model of "the git information is always tied directly to -the working tree that it describes" may not be technically 100% -accurate, but it's a good model for all normal use. - -This has two implications: - - - if you grow bored with the tutorial repository you created (or you've - made a mistake and want to start all over), you can just do simple -+ ----------------- -$ rm -rf git-tutorial ----------------- -+ -and it will be gone. There's no external repository, and there's no -history outside the project you created. - - - if you want to move or duplicate a git repository, you can do so. There - is `git clone` command, but if all you want to do is just to - create a copy of your repository (with all the full history that - went along with it), you can do so with a regular - `cp -a git-tutorial new-git-tutorial`. -+ -Note that when you've moved or copied a git repository, your git index -file (which caches various information, notably some of the "stat" -information for the files involved) will likely need to be refreshed. -So after you do a `cp -a` to create a new copy, you'll want to do -+ ----------------- -$ git-update-index --refresh ----------------- -+ -in the new repository to make sure that the index file is up-to-date. - -Note that the second point is true even across machines. You can -duplicate a remote git repository with *any* regular copy mechanism, be it -`scp`, `rsync` or `wget`. - -When copying a remote repository, you'll want to at a minimum update the -index cache when you do this, and especially with other peoples' -repositories you often want to make sure that the index cache is in some -known state (you don't know *what* they've done and not yet checked in), -so usually you'll precede the `git-update-index` with a - ----------------- -$ git-read-tree --reset HEAD -$ git-update-index --refresh ----------------- - -which will force a total index re-build from the tree pointed to by `HEAD`. -It resets the index contents to `HEAD`, and then the `git-update-index` -makes sure to match up all index entries with the checked-out files. -If the original repository had uncommitted changes in its -working tree, `git-update-index --refresh` notices them and -tells you they need to be updated. - -The above can also be written as simply - ----------------- -$ git reset ----------------- - -and in fact a lot of the common git command combinations can be scripted -with the `git xyz` interfaces. You can learn things by just looking -at what the various git scripts do. For example, `git reset` used to be -the above two lines implemented in `git-reset`, but some things like -`git status` and `git commit` are slightly more complex scripts around -the basic git commands. - -Many (most?) public remote repositories will not contain any of -the checked out files or even an index file, and will *only* contain the -actual core git files. Such a repository usually doesn't even have the -`.git` subdirectory, but has all the git files directly in the -repository. - -To create your own local live copy of such a "raw" git repository, you'd -first create your own subdirectory for the project, and then copy the -raw repository contents into the `.git` directory. For example, to -create your own copy of the git repository, you'd do the following - ----------------- -$ mkdir my-git -$ cd my-git -$ rsync -rL rsync://rsync.kernel.org/pub/scm/git/git.git/ .git ----------------- - -followed by - ----------------- -$ git-read-tree HEAD ----------------- - -to populate the index. However, now you have populated the index, and -you have all the git internal files, but you will notice that you don't -actually have any of the working tree files to work on. To get -those, you'd check them out with - ----------------- -$ git-checkout-index -u -a ----------------- - -where the `-u` flag means that you want the checkout to keep the index -up-to-date (so that you don't have to refresh it afterward), and the -`-a` flag means "check out all files" (if you have a stale copy or an -older version of a checked out tree you may also need to add the `-f` -flag first, to tell git-checkout-index to *force* overwriting of any old -files). - -Again, this can all be simplified with - ----------------- -$ git clone rsync://rsync.kernel.org/pub/scm/git/git.git/ my-git -$ cd my-git -$ git checkout ----------------- - -which will end up doing all of the above for you. - -You have now successfully copied somebody else's (mine) remote -repository, and checked it out. - - -Creating a new branch ---------------------- - -Branches in git are really nothing more than pointers into the git -object database from within the `.git/refs/` subdirectory, and as we -already discussed, the `HEAD` branch is nothing but a symlink to one of -these object pointers. - -You can at any time create a new branch by just picking an arbitrary -point in the project history, and just writing the SHA1 name of that -object into a file under `.git/refs/heads/`. You can use any filename you -want (and indeed, subdirectories), but the convention is that the -"normal" branch is called `master`. That's just a convention, though, -and nothing enforces it. - -To show that as an example, let's go back to the git-tutorial repository we -used earlier, and create a branch in it. You do that by simply just -saying that you want to check out a new branch: - ------------- -$ git checkout -b mybranch ------------- - -will create a new branch based at the current `HEAD` position, and switch -to it. - -[NOTE] -================================================ -If you make the decision to start your new branch at some -other point in the history than the current `HEAD`, you can do so by -just telling `git checkout` what the base of the checkout would be. -In other words, if you have an earlier tag or branch, you'd just do - ------------- -$ git checkout -b mybranch earlier-commit ------------- - -and it would create the new branch `mybranch` at the earlier commit, -and check out the state at that time. -================================================ - -You can always just jump back to your original `master` branch by doing - ------------- -$ git checkout master ------------- - -(or any other branch-name, for that matter) and if you forget which -branch you happen to be on, a simple - ------------- -$ cat .git/HEAD ------------- - -will tell you where it's pointing. To get the list of branches -you have, you can say - ------------- -$ git branch ------------- - -which used to be nothing more than a simple script around `ls .git/refs/heads`. -There will be an asterisk in front of the branch you are currently on. - -Sometimes you may wish to create a new branch _without_ actually -checking it out and switching to it. If so, just use the command - ------------- -$ git branch [startingpoint] ------------- - -which will simply _create_ the branch, but will not do anything further. -You can then later -- once you decide that you want to actually develop -on that branch -- switch to that branch with a regular `git checkout` -with the branchname as the argument. - - -Merging two branches --------------------- - -One of the ideas of having a branch is that you do some (possibly -experimental) work in it, and eventually merge it back to the main -branch. So assuming you created the above `mybranch` that started out -being the same as the original `master` branch, let's make sure we're in -that branch, and do some work there. - ------------------------------------------------- -$ git checkout mybranch -$ echo "Work, work, work" >>hello -$ git commit -m "Some work." -i hello ------------------------------------------------- - -Here, we just added another line to `hello`, and we used a shorthand for -doing both `git-update-index hello` and `git commit` by just giving the -filename directly to `git commit`, with an `-i` flag (it tells -git to 'include' that file in addition to what you have done to -the index file so far when making the commit). The `-m` flag is to give the -commit log message from the command line. - -Now, to make it a bit more interesting, let's assume that somebody else -does some work in the original branch, and simulate that by going back -to the master branch, and editing the same file differently there: - ------------- -$ git checkout master ------------- - -Here, take a moment to look at the contents of `hello`, and notice how they -don't contain the work we just did in `mybranch` -- because that work -hasn't happened in the `master` branch at all. Then do - ------------- -$ echo "Play, play, play" >>hello -$ echo "Lots of fun" >>example -$ git commit -m "Some fun." -i hello example ------------- - -since the master branch is obviously in a much better mood. - -Now, you've got two branches, and you decide that you want to merge the -work done. Before we do that, let's introduce a cool graphical tool that -helps you view what's going on: - ----------------- -$ gitk --all ----------------- - -will show you graphically both of your branches (that's what the `\--all` -means: normally it will just show you your current `HEAD`) and their -histories. You can also see exactly how they came to be from a common -source. - -Anyway, let's exit `gitk` (`^Q` or the File menu), and decide that we want -to merge the work we did on the `mybranch` branch into the `master` -branch (which is currently our `HEAD` too). To do that, there's a nice -script called `git merge`, which wants to know which branches you want -to resolve and what the merge is all about: - ------------- -$ git merge -m "Merge work in mybranch" mybranch ------------- - -where the first argument is going to be used as the commit message if -the merge can be resolved automatically. - -Now, in this case we've intentionally created a situation where the -merge will need to be fixed up by hand, though, so git will do as much -of it as it can automatically (which in this case is just merge the `example` -file, which had no differences in the `mybranch` branch), and say: - ----------------- - Auto-merging hello - CONFLICT (content): Merge conflict in hello - Automatic merge failed; fix up by hand ----------------- - -It tells you that it did an "Automatic merge", which -failed due to conflicts in `hello`. - -Not to worry. It left the (trivial) conflict in `hello` in the same form you -should already be well used to if you've ever used CVS, so let's just -open `hello` in our editor (whatever that may be), and fix it up somehow. -I'd suggest just making it so that `hello` contains all four lines: - ------------- -Hello World -It's a new day for git -Play, play, play -Work, work, work ------------- - -and once you're happy with your manual merge, just do a - ------------- -$ git commit -i hello ------------- - -which will very loudly warn you that you're now committing a merge -(which is correct, so never mind), and you can write a small merge -message about your adventures in git-merge-land. - -After you're done, start up `gitk \--all` to see graphically what the -history looks like. Notice that `mybranch` still exists, and you can -switch to it, and continue to work with it if you want to. The -`mybranch` branch will not contain the merge, but next time you merge it -from the `master` branch, git will know how you merged it, so you'll not -have to do _that_ merge again. - -Another useful tool, especially if you do not always work in X-Window -environment, is `git show-branch`. - ------------------------------------------------- -$ git-show-branch --topo-order --more=1 master mybranch -* [master] Merge work in mybranch - ! [mybranch] Some work. --- -- [master] Merge work in mybranch -*+ [mybranch] Some work. -* [master^] Some fun. ------------------------------------------------- - -The first two lines indicate that it is showing the two branches -and the first line of the commit log message from their -top-of-the-tree commits, you are currently on `master` branch -(notice the asterisk `\*` character), and the first column for -the later output lines is used to show commits contained in the -`master` branch, and the second column for the `mybranch` -branch. Three commits are shown along with their log messages. -All of them have non blank characters in the first column (`*` -shows an ordinary commit on the current branch, `-` is a merge commit), which -means they are now part of the `master` branch. Only the "Some -work" commit has the plus `+` character in the second column, -because `mybranch` has not been merged to incorporate these -commits from the master branch. The string inside brackets -before the commit log message is a short name you can use to -name the commit. In the above example, 'master' and 'mybranch' -are branch heads. 'master^' is the first parent of 'master' -branch head. Please see 'git-rev-parse' documentation if you -see more complex cases. - -[NOTE] -Without the '--more=1' option, 'git-show-branch' would not output the -'[master^]' commit, as '[mybranch]' commit is a common ancestor of -both 'master' and 'mybranch' tips. Please see 'git-show-branch' -documentation for details. - -[NOTE] -If there were more commits on the 'master' branch after the merge, the -merge commit itself would not be shown by 'git-show-branch' by -default. You would need to provide '--sparse' option to make the -merge commit visible in this case. - -Now, let's pretend you are the one who did all the work in -`mybranch`, and the fruit of your hard work has finally been merged -to the `master` branch. Let's go back to `mybranch`, and run -`git merge` to get the "upstream changes" back to your branch. - ------------- -$ git checkout mybranch -$ git merge -m "Merge upstream changes." master ------------- - -This outputs something like this (the actual commit object names -would be different) - ----------------- -Updating from ae3a2da... to a80b4aa.... -Fast forward - example | 1 + - hello | 1 + - 2 files changed, 2 insertions(+), 0 deletions(-) ----------------- - -Because your branch did not contain anything more than what are -already merged into the `master` branch, the merge operation did -not actually do a merge. Instead, it just updated the top of -the tree of your branch to that of the `master` branch. This is -often called 'fast forward' merge. - -You can run `gitk \--all` again to see how the commit ancestry -looks like, or run `show-branch`, which tells you this. - ------------------------------------------------- -$ git show-branch master mybranch -! [master] Merge work in mybranch - * [mybranch] Merge work in mybranch --- --- [master] Merge work in mybranch ------------------------------------------------- - - -Merging external work ---------------------- - -It's usually much more common that you merge with somebody else than -merging with your own branches, so it's worth pointing out that git -makes that very easy too, and in fact, it's not that different from -doing a `git merge`. In fact, a remote merge ends up being nothing -more than "fetch the work from a remote repository into a temporary tag" -followed by a `git merge`. - -Fetching from a remote repository is done by, unsurprisingly, -`git fetch`: - ----------------- -$ git fetch ----------------- - -One of the following transports can be used to name the -repository to download from: - -Rsync:: - `rsync://remote.machine/path/to/repo.git/` -+ -Rsync transport is usable for both uploading and downloading, -but is completely unaware of what git does, and can produce -unexpected results when you download from the public repository -while the repository owner is uploading into it via `rsync` -transport. Most notably, it could update the files under -`refs/` which holds the object name of the topmost commits -before uploading the files in `objects/` -- the downloader would -obtain head commit object name while that object itself is still -not available in the repository. For this reason, it is -considered deprecated. - -SSH:: - `remote.machine:/path/to/repo.git/` or -+ -`ssh://remote.machine/path/to/repo.git/` -+ -This transport can be used for both uploading and downloading, -and requires you to have a log-in privilege over `ssh` to the -remote machine. It finds out the set of objects the other side -lacks by exchanging the head commits both ends have and -transfers (close to) minimum set of objects. It is by far the -most efficient way to exchange git objects between repositories. - -Local directory:: - `/path/to/repo.git/` -+ -This transport is the same as SSH transport but uses `sh` to run -both ends on the local machine instead of running other end on -the remote machine via `ssh`. - -git Native:: - `git://remote.machine/path/to/repo.git/` -+ -This transport was designed for anonymous downloading. Like SSH -transport, it finds out the set of objects the downstream side -lacks and transfers (close to) minimum set of objects. - -HTTP(S):: - `http://remote.machine/path/to/repo.git/` -+ -Downloader from http and https URL -first obtains the topmost commit object name from the remote site -by looking at the specified refname under `repo.git/refs/` directory, -and then tries to obtain the -commit object by downloading from `repo.git/objects/xx/xxx\...` -using the object name of that commit object. Then it reads the -commit object to find out its parent commits and the associate -tree object; it repeats this process until it gets all the -necessary objects. Because of this behavior, they are -sometimes also called 'commit walkers'. -+ -The 'commit walkers' are sometimes also called 'dumb -transports', because they do not require any git aware smart -server like git Native transport does. Any stock HTTP server -that does not even support directory index would suffice. But -you must prepare your repository with `git-update-server-info` -to help dumb transport downloaders. - -Once you fetch from the remote repository, you `merge` that -with your current branch. - -However -- it's such a common thing to `fetch` and then -immediately `merge`, that it's called `git pull`, and you can -simply do - ----------------- -$ git pull ----------------- - -and optionally give a branch-name for the remote end as a second -argument. - -[NOTE] -You could do without using any branches at all, by -keeping as many local repositories as you would like to have -branches, and merging between them with `git pull`, just like -you merge between branches. The advantage of this approach is -that it lets you keep a set of files for each `branch` checked -out and you may find it easier to switch back and forth if you -juggle multiple lines of development simultaneously. Of -course, you will pay the price of more disk usage to hold -multiple working trees, but disk space is cheap these days. - -It is likely that you will be pulling from the same remote -repository from time to time. As a short hand, you can store -the remote repository URL in the local repository's config file -like this: - ------------------------------------------------- -$ git config remote.linus.url http://www.kernel.org/pub/scm/git/git.git/ ------------------------------------------------- - -and use the "linus" keyword with `git pull` instead of the full URL. - -Examples. - -. `git pull linus` -. `git pull linus tag v0.99.1` - -the above are equivalent to: - -. `git pull http://www.kernel.org/pub/scm/git/git.git/ HEAD` -. `git pull http://www.kernel.org/pub/scm/git/git.git/ tag v0.99.1` - - -How does the merge work? ------------------------- - -We said this tutorial shows what plumbing does to help you cope -with the porcelain that isn't flushing, but we so far did not -talk about how the merge really works. If you are following -this tutorial the first time, I'd suggest to skip to "Publishing -your work" section and come back here later. - -OK, still with me? To give us an example to look at, let's go -back to the earlier repository with "hello" and "example" file, -and bring ourselves back to the pre-merge state: - ------------- -$ git show-branch --more=2 master mybranch -! [master] Merge work in mybranch - * [mybranch] Merge work in mybranch --- --- [master] Merge work in mybranch -+* [master^2] Some work. -+* [master^] Some fun. ------------- - -Remember, before running `git merge`, our `master` head was at -"Some fun." commit, while our `mybranch` head was at "Some -work." commit. - ------------- -$ git checkout mybranch -$ git reset --hard master^2 -$ git checkout master -$ git reset --hard master^ ------------- - -After rewinding, the commit structure should look like this: - ------------- -$ git show-branch -* [master] Some fun. - ! [mybranch] Some work. --- - + [mybranch] Some work. -* [master] Some fun. -*+ [mybranch^] New day. ------------- - -Now we are ready to experiment with the merge by hand. - -`git merge` command, when merging two branches, uses 3-way merge -algorithm. First, it finds the common ancestor between them. -The command it uses is `git-merge-base`: - ------------- -$ mb=$(git-merge-base HEAD mybranch) ------------- - -The command writes the commit object name of the common ancestor -to the standard output, so we captured its output to a variable, -because we will be using it in the next step. By the way, the common -ancestor commit is the "New day." commit in this case. You can -tell it by: - ------------- -$ git-name-rev $mb -my-first-tag ------------- - -After finding out a common ancestor commit, the second step is -this: - ------------- -$ git-read-tree -m -u $mb HEAD mybranch ------------- - -This is the same `git-read-tree` command we have already seen, -but it takes three trees, unlike previous examples. This reads -the contents of each tree into different 'stage' in the index -file (the first tree goes to stage 1, the second to stage 2, -etc.). After reading three trees into three stages, the paths -that are the same in all three stages are 'collapsed' into stage -0. Also paths that are the same in two of three stages are -collapsed into stage 0, taking the SHA1 from either stage 2 or -stage 3, whichever is different from stage 1 (i.e. only one side -changed from the common ancestor). - -After 'collapsing' operation, paths that are different in three -trees are left in non-zero stages. At this point, you can -inspect the index file with this command: - ------------- -$ git-ls-files --stage -100644 7f8b141b65fdcee47321e399a2598a235a032422 0 example -100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello -100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello -100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello ------------- - -In our example of only two files, we did not have unchanged -files so only 'example' resulted in collapsing, but in real-life -large projects, only small number of files change in one commit, -and this 'collapsing' tends to trivially merge most of the paths -fairly quickly, leaving only a handful the real changes in non-zero -stages. - -To look at only non-zero stages, use `\--unmerged` flag: - ------------- -$ git-ls-files --unmerged -100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello -100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello -100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello ------------- - -The next step of merging is to merge these three versions of the -file, using 3-way merge. This is done by giving -`git-merge-one-file` command as one of the arguments to -`git-merge-index` command: - ------------- -$ git-merge-index git-merge-one-file hello -Auto-merging hello. -merge: warning: conflicts during merge -ERROR: Merge conflict in hello. -fatal: merge program failed ------------- - -`git-merge-one-file` script is called with parameters to -describe those three versions, and is responsible to leave the -merge results in the working tree. -It is a fairly straightforward shell script, and -eventually calls `merge` program from RCS suite to perform a -file-level 3-way merge. In this case, `merge` detects -conflicts, and the merge result with conflict marks is left in -the working tree.. This can be seen if you run `ls-files ---stage` again at this point: - ------------- -$ git-ls-files --stage -100644 7f8b141b65fdcee47321e399a2598a235a032422 0 example -100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello -100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello -100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello ------------- - -This is the state of the index file and the working file after -`git merge` returns control back to you, leaving the conflicting -merge for you to resolve. Notice that the path `hello` is still -unmerged, and what you see with `git diff` at this point is -differences since stage 2 (i.e. your version). - - -Publishing your work --------------------- - -So, we can use somebody else's work from a remote repository, but -how can *you* prepare a repository to let other people pull from -it? - -You do your real work in your working tree that has your -primary repository hanging under it as its `.git` subdirectory. -You *could* make that repository accessible remotely and ask -people to pull from it, but in practice that is not the way -things are usually done. A recommended way is to have a public -repository, make it reachable by other people, and when the -changes you made in your primary working tree are in good shape, -update the public repository from it. This is often called -'pushing'. - -[NOTE] -This public repository could further be mirrored, and that is -how git repositories at `kernel.org` are managed. - -Publishing the changes from your local (private) repository to -your remote (public) repository requires a write privilege on -the remote machine. You need to have an SSH account there to -run a single command, `git-receive-pack`. - -First, you need to create an empty repository on the remote -machine that will house your public repository. This empty -repository will be populated and be kept up-to-date by pushing -into it later. Obviously, this repository creation needs to be -done only once. - -[NOTE] -`git push` uses a pair of programs, -`git-send-pack` on your local machine, and `git-receive-pack` -on the remote machine. The communication between the two over -the network internally uses an SSH connection. - -Your private repository's git directory is usually `.git`, but -your public repository is often named after the project name, -i.e. `.git`. Let's create such a public repository for -project `my-git`. After logging into the remote machine, create -an empty directory: - ------------- -$ mkdir my-git.git ------------- - -Then, make that directory into a git repository by running -`git init`, but this time, since its name is not the usual -`.git`, we do things slightly differently: - ------------- -$ GIT_DIR=my-git.git git-init ------------- - -Make sure this directory is available for others you want your -changes to be pulled by via the transport of your choice. Also -you need to make sure that you have the `git-receive-pack` -program on the `$PATH`. - -[NOTE] -Many installations of sshd do not invoke your shell as the login -shell when you directly run programs; what this means is that if -your login shell is `bash`, only `.bashrc` is read and not -`.bash_profile`. As a workaround, make sure `.bashrc` sets up -`$PATH` so that you can run `git-receive-pack` program. - -[NOTE] -If you plan to publish this repository to be accessed over http, -you should do `chmod +x my-git.git/hooks/post-update` at this -point. This makes sure that every time you push into this -repository, `git-update-server-info` is run. - -Your "public repository" is now ready to accept your changes. -Come back to the machine you have your private repository. From -there, run this command: - ------------- -$ git push :/path/to/my-git.git master ------------- - -This synchronizes your public repository to match the named -branch head (i.e. `master` in this case) and objects reachable -from them in your current repository. - -As a real example, this is how I update my public git -repository. Kernel.org mirror network takes care of the -propagation to other publicly visible machines: - ------------- -$ git push master.kernel.org:/pub/scm/git/git.git/ ------------- - - -Packing your repository ------------------------ - -Earlier, we saw that one file under `.git/objects/??/` directory -is stored for each git object you create. This representation -is efficient to create atomically and safely, but -not so convenient to transport over the network. Since git objects are -immutable once they are created, there is a way to optimize the -storage by "packing them together". The command - ------------- -$ git repack ------------- - -will do it for you. If you followed the tutorial examples, you -would have accumulated about 17 objects in `.git/objects/??/` -directories by now. `git repack` tells you how many objects it -packed, and stores the packed file in `.git/objects/pack` -directory. - -[NOTE] -You will see two files, `pack-\*.pack` and `pack-\*.idx`, -in `.git/objects/pack` directory. They are closely related to -each other, and if you ever copy them by hand to a different -repository for whatever reason, you should make sure you copy -them together. The former holds all the data from the objects -in the pack, and the latter holds the index for random -access. - -If you are paranoid, running `git-verify-pack` command would -detect if you have a corrupt pack, but do not worry too much. -Our programs are always perfect ;-). - -Once you have packed objects, you do not need to leave the -unpacked objects that are contained in the pack file anymore. - ------------- -$ git prune-packed ------------- - -would remove them for you. - -You can try running `find .git/objects -type f` before and after -you run `git prune-packed` if you are curious. Also `git -count-objects` would tell you how many unpacked objects are in -your repository and how much space they are consuming. - -[NOTE] -`git pull` is slightly cumbersome for HTTP transport, as a -packed repository may contain relatively few objects in a -relatively large pack. If you expect many HTTP pulls from your -public repository you might want to repack & prune often, or -never. - -If you run `git repack` again at this point, it will say -"Nothing to pack". Once you continue your development and -accumulate the changes, running `git repack` again will create a -new pack, that contains objects created since you packed your -repository the last time. We recommend that you pack your project -soon after the initial import (unless you are starting your -project from scratch), and then run `git repack` every once in a -while, depending on how active your project is. - -When a repository is synchronized via `git push` and `git pull` -objects packed in the source repository are usually stored -unpacked in the destination, unless rsync transport is used. -While this allows you to use different packing strategies on -both ends, it also means you may need to repack both -repositories every once in a while. - - -Working with Others -------------------- - -Although git is a truly distributed system, it is often -convenient to organize your project with an informal hierarchy -of developers. Linux kernel development is run this way. There -is a nice illustration (page 17, "Merges to Mainline") in -link:http://www.xenotime.net/linux/mentor/linux-mentoring-2006.pdf[Randy Dunlap's presentation]. - -It should be stressed that this hierarchy is purely *informal*. -There is nothing fundamental in git that enforces the "chain of -patch flow" this hierarchy implies. You do not have to pull -from only one remote repository. - -A recommended workflow for a "project lead" goes like this: - -1. Prepare your primary repository on your local machine. Your - work is done there. - -2. Prepare a public repository accessible to others. -+ -If other people are pulling from your repository over dumb -transport protocols (HTTP), you need to keep this repository -'dumb transport friendly'. After `git init`, -`$GIT_DIR/hooks/post-update` copied from the standard templates -would contain a call to `git-update-server-info` but the -`post-update` hook itself is disabled by default -- enable it -with `chmod +x post-update`. This makes sure `git-update-server-info` -keeps the necessary files up-to-date. - -3. Push into the public repository from your primary - repository. - -4. `git repack` the public repository. This establishes a big - pack that contains the initial set of objects as the - baseline, and possibly `git prune` if the transport - used for pulling from your repository supports packed - repositories. - -5. Keep working in your primary repository. Your changes - include modifications of your own, patches you receive via - e-mails, and merges resulting from pulling the "public" - repositories of your "subsystem maintainers". -+ -You can repack this private repository whenever you feel like. - -6. Push your changes to the public repository, and announce it - to the public. - -7. Every once in a while, "git repack" the public repository. - Go back to step 5. and continue working. - - -A recommended work cycle for a "subsystem maintainer" who works -on that project and has an own "public repository" goes like this: - -1. Prepare your work repository, by `git clone` the public - repository of the "project lead". The URL used for the - initial cloning is stored in the remote.origin.url - configuration variable. - -2. Prepare a public repository accessible to others, just like - the "project lead" person does. - -3. Copy over the packed files from "project lead" public - repository to your public repository, unless the "project - lead" repository lives on the same machine as yours. In the - latter case, you can use `objects/info/alternates` file to - point at the repository you are borrowing from. - -4. Push into the public repository from your primary - repository. Run `git repack`, and possibly `git prune` if the - transport used for pulling from your repository supports - packed repositories. - -5. Keep working in your primary repository. Your changes - include modifications of your own, patches you receive via - e-mails, and merges resulting from pulling the "public" - repositories of your "project lead" and possibly your - "sub-subsystem maintainers". -+ -You can repack this private repository whenever you feel -like. - -6. Push your changes to your public repository, and ask your - "project lead" and possibly your "sub-subsystem - maintainers" to pull from it. - -7. Every once in a while, `git repack` the public repository. - Go back to step 5. and continue working. - - -A recommended work cycle for an "individual developer" who does -not have a "public" repository is somewhat different. It goes -like this: - -1. Prepare your work repository, by `git clone` the public - repository of the "project lead" (or a "subsystem - maintainer", if you work on a subsystem). The URL used for - the initial cloning is stored in the remote.origin.url - configuration variable. - -2. Do your work in your repository on 'master' branch. - -3. Run `git fetch origin` from the public repository of your - upstream every once in a while. This does only the first - half of `git pull` but does not merge. The head of the - public repository is stored in `.git/refs/remotes/origin/master`. - -4. Use `git cherry origin` to see which ones of your patches - were accepted, and/or use `git rebase origin` to port your - unmerged changes forward to the updated upstream. - -5. Use `git format-patch origin` to prepare patches for e-mail - submission to your upstream and send it out. Go back to - step 2. and continue. - - -Working with Others, Shared Repository Style --------------------------------------------- - -If you are coming from CVS background, the style of cooperation -suggested in the previous section may be new to you. You do not -have to worry. git supports "shared public repository" style of -cooperation you are probably more familiar with as well. - -See link:cvs-migration.html[git for CVS users] for the details. - -Bundling your work together ---------------------------- - -It is likely that you will be working on more than one thing at -a time. It is easy to manage those more-or-less independent tasks -using branches with git. - -We have already seen how branches work previously, -with "fun and work" example using two branches. The idea is the -same if there are more than two branches. Let's say you started -out from "master" head, and have some new code in the "master" -branch, and two independent fixes in the "commit-fix" and -"diff-fix" branches: - ------------- -$ git show-branch -! [commit-fix] Fix commit message normalization. - ! [diff-fix] Fix rename detection. - * [master] Release candidate #1 ---- - + [diff-fix] Fix rename detection. - + [diff-fix~1] Better common substring algorithm. -+ [commit-fix] Fix commit message normalization. - * [master] Release candidate #1 -++* [diff-fix~2] Pretty-print messages. ------------- - -Both fixes are tested well, and at this point, you want to merge -in both of them. You could merge in 'diff-fix' first and then -'commit-fix' next, like this: - ------------- -$ git merge -m "Merge fix in diff-fix" diff-fix -$ git merge -m "Merge fix in commit-fix" commit-fix ------------- - -Which would result in: - ------------- -$ git show-branch -! [commit-fix] Fix commit message normalization. - ! [diff-fix] Fix rename detection. - * [master] Merge fix in commit-fix ---- - - [master] Merge fix in commit-fix -+ * [commit-fix] Fix commit message normalization. - - [master~1] Merge fix in diff-fix - +* [diff-fix] Fix rename detection. - +* [diff-fix~1] Better common substring algorithm. - * [master~2] Release candidate #1 -++* [master~3] Pretty-print messages. ------------- - -However, there is no particular reason to merge in one branch -first and the other next, when what you have are a set of truly -independent changes (if the order mattered, then they are not -independent by definition). You could instead merge those two -branches into the current branch at once. First let's undo what -we just did and start over. We would want to get the master -branch before these two merges by resetting it to 'master~2': - ------------- -$ git reset --hard master~2 ------------- - -You can make sure 'git show-branch' matches the state before -those two 'git merge' you just did. Then, instead of running -two 'git merge' commands in a row, you would merge these two -branch heads (this is known as 'making an Octopus'): - ------------- -$ git merge commit-fix diff-fix -$ git show-branch -! [commit-fix] Fix commit message normalization. - ! [diff-fix] Fix rename detection. - * [master] Octopus merge of branches 'diff-fix' and 'commit-fix' ---- - - [master] Octopus merge of branches 'diff-fix' and 'commit-fix' -+ * [commit-fix] Fix commit message normalization. - +* [diff-fix] Fix rename detection. - +* [diff-fix~1] Better common substring algorithm. - * [master~1] Release candidate #1 -++* [master~2] Pretty-print messages. ------------- - -Note that you should not do Octopus because you can. An octopus -is a valid thing to do and often makes it easier to view the -commit history if you are merging more than two independent -changes at the same time. However, if you have merge conflicts -with any of the branches you are merging in and need to hand -resolve, that is an indication that the development happened in -those branches were not independent after all, and you should -merge two at a time, documenting how you resolved the conflicts, -and the reason why you preferred changes made in one side over -the other. Otherwise it would make the project history harder -to follow, not easier. diff --git a/Documentation/cvs-migration.txt b/Documentation/cvs-migration.txt deleted file mode 100644 index 00f2e36b2e..0000000000 --- a/Documentation/cvs-migration.txt +++ /dev/null @@ -1,172 +0,0 @@ -git for CVS users -================= - -Git differs from CVS in that every working tree contains a repository with -a full copy of the project history, and no repository is inherently more -important than any other. However, you can emulate the CVS model by -designating a single shared repository which people can synchronize with; -this document explains how to do that. - -Some basic familiarity with git is required. This -link:tutorial.html[tutorial introduction to git] and the -link:glossary.html[git glossary] should be sufficient. - -Developing against a shared repository --------------------------------------- - -Suppose a shared repository is set up in /pub/repo.git on the host -foo.com. Then as an individual committer you can clone the shared -repository over ssh with: - ------------------------------------------------- -$ git clone foo.com:/pub/repo.git/ my-project -$ cd my-project ------------------------------------------------- - -and hack away. The equivalent of `cvs update` is - ------------------------------------------------- -$ git pull origin ------------------------------------------------- - -which merges in any work that others might have done since the clone -operation. If there are uncommitted changes in your working tree, commit -them first before running git pull. - -[NOTE] -================================ -The `pull` command knows where to get updates from because of certain -configuration variables that were set by the first `git clone` -command; see `git config -l` and the linkgit:git-config[1] man -page for details. -================================ - -You can update the shared repository with your changes by first committing -your changes, and then using the linkgit:git-push[1] command: - ------------------------------------------------- -$ git push origin master ------------------------------------------------- - -to "push" those commits to the shared repository. If someone else has -updated the repository more recently, `git push`, like `cvs commit`, will -complain, in which case you must pull any changes before attempting the -push again. - -In the `git push` command above we specify the name of the remote branch -to update (`master`). If we leave that out, `git push` tries to update -any branches in the remote repository that have the same name as a branch -in the local repository. So the last `push` can be done with either of: - ------------- -$ git push origin -$ git push foo.com:/pub/project.git/ ------------- - -as long as the shared repository does not have any branches -other than `master`. - -Setting Up a Shared Repository ------------------------------- - -We assume you have already created a git repository for your project, -possibly created from scratch or from a tarball (see the -link:tutorial.html[tutorial]), or imported from an already existing CVS -repository (see the next section). - -Assume your existing repo is at /home/alice/myproject. Create a new "bare" -repository (a repository without a working tree) and fetch your project into -it: - ------------------------------------------------- -$ mkdir /pub/my-repo.git -$ cd /pub/my-repo.git -$ git --bare init --shared -$ git --bare fetch /home/alice/myproject master:master ------------------------------------------------- - -Next, give every team member read/write access to this repository. One -easy way to do this is to give all the team members ssh access to the -machine where the repository is hosted. If you don't want to give them a -full shell on the machine, there is a restricted shell which only allows -users to do git pushes and pulls; see linkgit:git-shell[1]. - -Put all the committers in the same group, and make the repository -writable by that group: - ------------------------------------------------- -$ chgrp -R $group /pub/my-repo.git ------------------------------------------------- - -Make sure committers have a umask of at most 027, so that the directories -they create are writable and searchable by other group members. - -Importing a CVS archive ------------------------ - -First, install version 2.1 or higher of cvsps from -link:http://www.cobite.com/cvsps/[http://www.cobite.com/cvsps/] and make -sure it is in your path. Then cd to a checked out CVS working directory -of the project you are interested in and run linkgit:git-cvsimport[1]: - -------------------------------------------- -$ git cvsimport -C -------------------------------------------- - -This puts a git archive of the named CVS module in the directory -, which will be created if necessary. - -The import checks out from CVS every revision of every file. Reportedly -cvsimport can average some twenty revisions per second, so for a -medium-sized project this should not take more than a couple of minutes. -Larger projects or remote repositories may take longer. - -The main trunk is stored in the git branch named `origin`, and additional -CVS branches are stored in git branches with the same names. The most -recent version of the main trunk is also left checked out on the `master` -branch, so you can start adding your own changes right away. - -The import is incremental, so if you call it again next month it will -fetch any CVS updates that have been made in the meantime. For this to -work, you must not modify the imported branches; instead, create new -branches for your own changes, and merge in the imported branches as -necessary. - -Advanced Shared Repository Management -------------------------------------- - -Git allows you to specify scripts called "hooks" to be run at certain -points. You can use these, for example, to send all commits to the shared -repository to a mailing list. See link:hooks.html[Hooks used by git]. - -You can enforce finer grained permissions using update hooks. See -link:howto/update-hook-example.txt[Controlling access to branches using -update hooks]. - -Providing CVS Access to a git Repository ----------------------------------------- - -It is also possible to provide true CVS access to a git repository, so -that developers can still use CVS; see linkgit:git-cvsserver[1] for -details. - -Alternative Development Models ------------------------------- - -CVS users are accustomed to giving a group of developers commit access to -a common repository. As we've seen, this is also possible with git. -However, the distributed nature of git allows other development models, -and you may want to first consider whether one of them might be a better -fit for your project. - -For example, you can choose a single person to maintain the project's -primary public repository. Other developers then clone this repository -and each work in their own clone. When they have a series of changes that -they're happy with, they ask the maintainer to pull from the branch -containing the changes. The maintainer reviews their changes and pulls -them into the primary repository, which other developers pull from as -necessary to stay coordinated. The Linux kernel and other projects use -variants of this model. - -With a small group, developers may just pull changes from each other's -repositories without the need for a central maintainer. diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 13234fa280..572154834b 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -228,6 +228,9 @@ endif::git-format-patch[] --no-ext-diff:: Disallow external diff drivers. +--ignore-submodules:: + Ignore changes to submodules in the diff generation. + --src-prefix=:: Show the given source prefix instead of "a/". @@ -238,4 +241,4 @@ endif::git-format-patch[] Do not show any source or destination prefix. For more detailed explanation on these common options, see also -link:diffcore.html[diffcore documentation]. +linkgit:gitdiffcore[7][diffcore documentation]. diff --git a/Documentation/diffcore.txt b/Documentation/diffcore.txt deleted file mode 100644 index c6a983a5d5..0000000000 --- a/Documentation/diffcore.txt +++ /dev/null @@ -1,271 +0,0 @@ -Tweaking diff output -==================== -June 2005 - - -Introduction ------------- - -The diff commands git-diff-index, git-diff-files, and git-diff-tree -can be told to manipulate differences they find in -unconventional ways before showing diff(1) output. The manipulation -is collectively called "diffcore transformation". This short note -describes what they are and how to use them to produce diff outputs -that are easier to understand than the conventional kind. - - -The chain of operation ----------------------- - -The git-diff-* family works by first comparing two sets of -files: - - - git-diff-index compares contents of a "tree" object and the - working directory (when '\--cached' flag is not used) or a - "tree" object and the index file (when '\--cached' flag is - used); - - - git-diff-files compares contents of the index file and the - working directory; - - - git-diff-tree compares contents of two "tree" objects; - -In all of these cases, the commands themselves compare -corresponding paths in the two sets of files. The result of -comparison is passed from these commands to what is internally -called "diffcore", in a format similar to what is output when -the -p option is not used. E.g. - ------------------------------------------------- -in-place edit :100644 100644 bcd1234... 0123456... M file0 -create :000000 100644 0000000... 1234567... A file4 -delete :100644 000000 1234567... 0000000... D file5 -unmerged :000000 000000 0000000... 0000000... U file6 ------------------------------------------------- - -The diffcore mechanism is fed a list of such comparison results -(each of which is called "filepair", although at this point each -of them talks about a single file), and transforms such a list -into another list. There are currently 6 such transformations: - -- diffcore-pathspec -- diffcore-break -- diffcore-rename -- diffcore-merge-broken -- diffcore-pickaxe -- diffcore-order - -These are applied in sequence. The set of filepairs git-diff-\* -commands find are used as the input to diffcore-pathspec, and -the output from diffcore-pathspec is used as the input to the -next transformation. The final result is then passed to the -output routine and generates either diff-raw format (see Output -format sections of the manual for git-diff-\* commands) or -diff-patch format. - - -diffcore-pathspec: For Ignoring Files Outside Our Consideration ---------------------------------------------------------------- - -The first transformation in the chain is diffcore-pathspec, and -is controlled by giving the pathname parameters to the -git-diff-* commands on the command line. The pathspec is used -to limit the world diff operates in. It removes the filepairs -outside the specified set of pathnames. E.g. If the input set -of filepairs included: - ------------------------------------------------- -:100644 100644 bcd1234... 0123456... M junkfile ------------------------------------------------- - -but the command invocation was "git-diff-files myfile", then the -junkfile entry would be removed from the list because only "myfile" -is under consideration. - -Implementation note. For performance reasons, git-diff-tree -uses the pathname parameters on the command line to cull set of -filepairs it feeds the diffcore mechanism itself, and does not -use diffcore-pathspec, but the end result is the same. - - -diffcore-break: For Splitting Up "Complete Rewrites" ----------------------------------------------------- - -The second transformation in the chain is diffcore-break, and is -controlled by the -B option to the git-diff-* commands. This is -used to detect a filepair that represents "complete rewrite" and -break such filepair into two filepairs that represent delete and -create. E.g. If the input contained this filepair: - ------------------------------------------------- -:100644 100644 bcd1234... 0123456... M file0 ------------------------------------------------- - -and if it detects that the file "file0" is completely rewritten, -it changes it to: - ------------------------------------------------- -:100644 000000 bcd1234... 0000000... D file0 -:000000 100644 0000000... 0123456... A file0 ------------------------------------------------- - -For the purpose of breaking a filepair, diffcore-break examines -the extent of changes between the contents of the files before -and after modification (i.e. the contents that have "bcd1234..." -and "0123456..." as their SHA1 content ID, in the above -example). The amount of deletion of original contents and -insertion of new material are added together, and if it exceeds -the "break score", the filepair is broken into two. The break -score defaults to 50% of the size of the smaller of the original -and the result (i.e. if the edit shrinks the file, the size of -the result is used; if the edit lengthens the file, the size of -the original is used), and can be customized by giving a number -after "-B" option (e.g. "-B75" to tell it to use 75%). - - -diffcore-rename: For Detection Renames and Copies -------------------------------------------------- - -This transformation is used to detect renames and copies, and is -controlled by the -M option (to detect renames) and the -C option -(to detect copies as well) to the git-diff-* commands. If the -input contained these filepairs: - ------------------------------------------------- -:100644 000000 0123456... 0000000... D fileX -:000000 100644 0000000... 0123456... A file0 ------------------------------------------------- - -and the contents of the deleted file fileX is similar enough to -the contents of the created file file0, then rename detection -merges these filepairs and creates: - ------------------------------------------------- -:100644 100644 0123456... 0123456... R100 fileX file0 ------------------------------------------------- - -When the "-C" option is used, the original contents of modified files, -and deleted files (and also unmodified files, if the -"\--find-copies-harder" option is used) are considered as candidates -of the source files in rename/copy operation. If the input were like -these filepairs, that talk about a modified file fileY and a newly -created file file0: - ------------------------------------------------- -:100644 100644 0123456... 1234567... M fileY -:000000 100644 0000000... bcd3456... A file0 ------------------------------------------------- - -the original contents of fileY and the resulting contents of -file0 are compared, and if they are similar enough, they are -changed to: - ------------------------------------------------- -:100644 100644 0123456... 1234567... M fileY -:100644 100644 0123456... bcd3456... C100 fileY file0 ------------------------------------------------- - -In both rename and copy detection, the same "extent of changes" -algorithm used in diffcore-break is used to determine if two -files are "similar enough", and can be customized to use -a similarity score different from the default of 50% by giving a -number after the "-M" or "-C" option (e.g. "-M8" to tell it to use -8/10 = 80%). - -Note. When the "-C" option is used with `\--find-copies-harder` -option, git-diff-\* commands feed unmodified filepairs to -diffcore mechanism as well as modified ones. This lets the copy -detector consider unmodified files as copy source candidates at -the expense of making it slower. Without `\--find-copies-harder`, -git-diff-\* commands can detect copies only if the file that was -copied happened to have been modified in the same changeset. - - -diffcore-merge-broken: For Putting "Complete Rewrites" Back Together --------------------------------------------------------------------- - -This transformation is used to merge filepairs broken by -diffcore-break, and not transformed into rename/copy by -diffcore-rename, back into a single modification. This always -runs when diffcore-break is used. - -For the purpose of merging broken filepairs back, it uses a -different "extent of changes" computation from the ones used by -diffcore-break and diffcore-rename. It counts only the deletion -from the original, and does not count insertion. If you removed -only 10 lines from a 100-line document, even if you added 910 -new lines to make a new 1000-line document, you did not do a -complete rewrite. diffcore-break breaks such a case in order to -help diffcore-rename to consider such filepairs as candidate of -rename/copy detection, but if filepairs broken that way were not -matched with other filepairs to create rename/copy, then this -transformation merges them back into the original -"modification". - -The "extent of changes" parameter can be tweaked from the -default 80% (that is, unless more than 80% of the original -material is deleted, the broken pairs are merged back into a -single modification) by giving a second number to -B option, -like these: - -* -B50/60 (give 50% "break score" to diffcore-break, use 60% - for diffcore-merge-broken). - -* -B/60 (the same as above, since diffcore-break defaults to 50%). - -Note that earlier implementation left a broken pair as a separate -creation and deletion patches. This was an unnecessary hack and -the latest implementation always merges all the broken pairs -back into modifications, but the resulting patch output is -formatted differently for easier review in case of such -a complete rewrite by showing the entire contents of old version -prefixed with '-', followed by the entire contents of new -version prefixed with '+'. - - -diffcore-pickaxe: For Detecting Addition/Deletion of Specified String ---------------------------------------------------------------------- - -This transformation is used to find filepairs that represent -changes that touch a specified string, and is controlled by the --S option and the `\--pickaxe-all` option to the git-diff-* -commands. - -When diffcore-pickaxe is in use, it checks if there are -filepairs whose "original" side has the specified string and -whose "result" side does not. Such a filepair represents "the -string appeared in this changeset". It also checks for the -opposite case that loses the specified string. - -When `\--pickaxe-all` is not in effect, diffcore-pickaxe leaves -only such filepairs that touch the specified string in its -output. When `\--pickaxe-all` is used, diffcore-pickaxe leaves all -filepairs intact if there is such a filepair, or makes the -output empty otherwise. The latter behaviour is designed to -make reviewing of the changes in the context of the whole -changeset easier. - - -diffcore-order: For Sorting the Output Based on Filenames ---------------------------------------------------------- - -This is used to reorder the filepairs according to the user's -(or project's) taste, and is controlled by the -O option to the -git-diff-* commands. - -This takes a text file each of whose lines is a shell glob -pattern. Filepairs that match a glob pattern on an earlier line -in the file are output before ones that match a later line, and -filepairs that do not match any glob pattern are output last. - -As an example, a typical orderfile for the core git probably -would look like this: - ------------------------------------------------- -README -Makefile -Documentation -*.h -*.c -t ------------------------------------------------- diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt index b675911480..85c87180db 100644 --- a/Documentation/fetch-options.txt +++ b/Documentation/fetch-options.txt @@ -1,22 +1,26 @@ --q, \--quiet:: +-q:: +--quiet:: Pass --quiet to git-fetch-pack and silence any other internally used programs. --v, \--verbose:: +-v:: +--verbose:: Be verbose. --a, \--append:: +-a:: +--append:: Append ref names and object names of fetched refs to the existing contents of `.git/FETCH_HEAD`. Without this option old data in `.git/FETCH_HEAD` will be overwritten. -\--upload-pack :: +--upload-pack :: When given, and the repository to fetch from is handled by 'git-fetch-pack', '--exec=' is passed to the command to specify non-default path for the command run on the other end. --f, \--force:: +-f:: +--force:: When `git-fetch` is used with `:` refspec, it refuses to update the local branch `` unless the remote branch `` it @@ -24,16 +28,18 @@ overrides that check. ifdef::git-pull[] -\--no-tags:: +--no-tags:: endif::git-pull[] ifndef::git-pull[] --n, \--no-tags:: +-n:: +--no-tags:: endif::git-pull[] By default, tags that point at objects that are downloaded from the remote repository are fetched and stored locally. This option disables this automatic tag following. --t, \--tags:: +-t:: +--tags:: Most of the tags are fetched automatically as branch heads are downloaded, but tags that do not point at objects reachable from the branch heads that are being @@ -41,10 +47,12 @@ endif::git-pull[] flag lets all tags and their associated objects be downloaded. --k, \--keep:: +-k:: +--keep:: Keep downloaded pack. --u, \--update-head-ok:: +-u:: +--update-head-ok:: By default `git-fetch` refuses to update the head which corresponds to the current branch. This flag disables the check. This is purely for the internal use for `git-pull` @@ -52,7 +60,7 @@ endif::git-pull[] implementing your own Porcelain you are not supposed to use it. -\--depth=:: +--depth=:: Deepen the history of a 'shallow' repository created by `git clone` with `--depth=` option (see linkgit:git-clone[1]) by the specified number of commits. diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index e2389e380b..b8e3fa6759 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -8,8 +8,9 @@ git-add - Add file contents to the index SYNOPSIS -------- [verse] -'git-add' [-n] [-v] [-f] [--interactive | -i] [--patch | -p] [-u] [--refresh] - [--] ... +'git-add' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p] + [--update | -u] [--refresh] [--ignore-errors] [--] + ... DESCRIPTION ----------- @@ -50,27 +51,33 @@ OPTIONS and `dir/file2`) can be given to add all files in the directory, recursively. --n, \--dry-run:: +-n:: +--dry-run:: Don't actually add the file(s), just show if they exist. --v, \--verbose:: +-v:: +--verbose:: Be verbose. -f:: +--force:: Allow adding otherwise ignored files. --i, \--interactive:: +-i:: +--interactive:: Add modified contents in the working tree interactively to the index. Optional path arguments may be supplied to limit operation to a subset of the working tree. See ``Interactive mode'' for details. --p, \--patch:: +-p:: +--patch:: Similar to Interactive mode but the initial command loop is bypassed and the 'patch' subcommand is invoked using each of the specified filepatterns before exiting. -u:: +--update:: Update only files that git already knows about, staging modified content for commit and marking deleted files for removal. This is similar @@ -79,10 +86,15 @@ OPTIONS command line. If no paths are specified, all tracked files in the current directory and its subdirectories are updated. -\--refresh:: +--refresh:: Don't add the file(s), but only refresh their stat() information in the index. +--ignore-errors:: + If some files could not be added because of errors indexing + them, do not abort the operation, but continue adding the + others. The command shall still exit with non-zero status. + \--:: This option can be used to separate command-line options from the list of files, (useful when filenames might be mistaken @@ -95,26 +107,32 @@ Configuration The optional configuration variable 'core.excludesfile' indicates a path to a file containing patterns of file names to exclude from git-add, similar to $GIT_DIR/info/exclude. Patterns in the exclude file are used in addition to -those in info/exclude. See link:repository-layout.html[repository layout]. +those in info/exclude. See linkgit:gitrepository-layout[5][repository layout]. EXAMPLES -------- -git-add Documentation/\\*.txt:: - Adds content from all `\*.txt` files under `Documentation` - directory and its subdirectories. +* Adds content from all `\*.txt` files under `Documentation` directory +and its subdirectories: ++ +------------ +$ git add Documentation/\\*.txt +------------ + Note that the asterisk `\*` is quoted from the shell in this example; this lets the command to include the files from subdirectories of `Documentation/` directory. -git-add git-*.sh:: - - Considers adding content from all git-*.sh scripts. - Because this example lets shell expand the asterisk - (i.e. you are listing the files explicitly), it does not - consider `subdir/git-foo.sh`. +* Considers adding content from all git-*.sh scripts: ++ +------------ +$ git add git-*.sh +------------ ++ +Because this example lets shell expand the asterisk (i.e. you are +listing the files explicitly), it does not consider +`subdir/git-foo.sh`. Interactive mode ---------------- @@ -235,7 +253,7 @@ characters that need C-quoting. `core.quotepath` configuration can be used to work this limitation around to some degree, but backslash, double-quote and control characters will still have problems. -See Also +SEE ALSO -------- linkgit:git-status[1] linkgit:git-rm[1] @@ -254,4 +272,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 2387a8d6c2..46544a0769 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -28,14 +28,17 @@ OPTIONS supply this argument, reads from the standard input. If you supply directories, they'll be treated as Maildirs. --s, --signoff:: +-s:: +--signoff:: Add `Signed-off-by:` line to the commit message, using the committer identity of yourself. --k, --keep:: +-k:: +--keep:: Pass `-k` flag to `git-mailinfo` (see linkgit:git-mailinfo[1]). --u, --utf8:: +-u:: +--utf8:: Pass `-u` flag to `git-mailinfo` (see linkgit:git-mailinfo[1]). The proposed commit log message taken from the e-mail is re-coded into UTF-8 encoding (configuration variable @@ -49,13 +52,15 @@ default. You could use `--no-utf8` to override this. Pass `-n` flag to `git-mailinfo` (see linkgit:git-mailinfo[1]). --3, --3way:: +-3:: +--3way:: When the patch does not apply cleanly, fall back on 3-way merge, if the patch records the identity of blobs it is supposed to apply to, and we have those blobs available locally. --b, --binary:: +-b:: +--binary:: Pass `--allow-binary-replacement` flag to `git-apply` (see linkgit:git-apply[1]). @@ -64,19 +69,22 @@ default. You could use `--no-utf8` to override this. program that applies the patch. --C, -p:: +-C:: +-p:: These flags are passed to the `git-apply` (see linkgit:git-apply[1]) program that applies the patch. --i, --interactive:: +-i:: +--interactive:: Run interactively. --skip:: Skip the current patch. This is only meaningful when restarting an aborted patch. --r, --resolved:: +-r:: +--resolved:: After a patch failure (e.g. attempting to apply conflicting patch), the user has applied it by hand and the index file stores the result of the application. @@ -153,4 +161,4 @@ Documentation by Petr Baudis, Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt index 2dec2ec1cf..c8347637da 100644 --- a/Documentation/git-apply.txt +++ b/Documentation/git-apply.txt @@ -73,7 +73,8 @@ OPTIONS When a pure mode change is encountered (which has no index information), the information is read from the current index instead. --R, --reverse:: +-R:: +--reverse:: Apply the patch in reverse. --reject:: @@ -124,7 +125,8 @@ discouraged. the result with this option, which would apply the deletion part but not addition part. ---allow-binary-replacement, --binary:: +--allow-binary-replacement:: +--binary:: Historically we did not allow binary patch applied without an explicit permission from the user, and this flag was the way to do so. Currently we always allow binary @@ -169,7 +171,8 @@ behavior: correctly. This option adds support for applying such patches by working around this bug. --v, --verbose:: +-v:: +--verbose:: Report progress to stderr. By default, only a message about the current patch being applied will be printed. This option will cause additional information to be reported. @@ -206,4 +209,4 @@ Documentation by Junio C Hamano GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-archimport.txt b/Documentation/git-archimport.txt index bd20fd8206..603117c796 100644 --- a/Documentation/git-archimport.txt +++ b/Documentation/git-archimport.txt @@ -117,4 +117,4 @@ Documentation by Junio C Hamano, Martin Langhoff and the git-list /:: @@ -118,4 +120,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list [...]] [--] [...] git bisect bad [] git bisect good [...] @@ -29,6 +30,12 @@ This command uses 'git-rev-list --bisect' option to help drive the binary search process to find which change introduced a bug, given an old "good" commit object name and a later "bad" commit object name. +Getting help +~~~~~~~~~~~~ + +Use "git bisect" to get a short usage description, and "git bisect +help" or "git bisect -h" to get a long usage description. + Basic bisect commands: start, bad, good ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -78,10 +85,9 @@ Oh, and then after you want to reset to the original head, do a $ git bisect reset ------------------------------------------------ -to get back to the original branch, instead of being in one of the -bisection branches ("git bisect start" will do that for you too, -actually: it will reset the bisection state, and before it does that -it checks that you're not using some old bisection branch). +to get back to the original branch, instead of being on the bisection +commit ("git bisect start" will do that for you too, actually: it will +reset the bisection state). Bisect visualize ~~~~~~~~~~~~~~~~ @@ -217,6 +223,55 @@ tree to the pristine state. Finally the "run" script can exit with the status of the real test to let "git bisect run" command loop to know the outcome. +EXAMPLES +-------- + +* Automatically bisect a broken build between v1.2 and HEAD: ++ +------------ +$ git bisect start HEAD v1.2 -- # HEAD is bad, v1.2 is good +$ git bisect run make # "make" builds the app +------------ + +* Automatically bisect a broken test suite: ++ +------------ +$ cat ~/test.sh +#!/bin/sh +make || exit 125 # this "skip"s broken builds +make test # "make test" runs the test suite +$ git bisect start v1.3 v1.1 -- # v1.3 is bad, v1.1 is good +$ git bisect run ~/test.sh +------------ ++ +Here we use a "test.sh" custom script. In this script, if "make" +fails, we "skip" the current commit. ++ +It's safer to use a custom script outside the repo to prevent +interactions between the bisect, make and test processes and the +script. ++ +And "make test" should "exit 0", if the test suite passes, and +"exit 1" (for example) otherwise. + +* Automatically bisect a broken test case: ++ +------------ +$ cat ~/test.sh +#!/bin/sh +make || exit 125 # this "skip"s broken builds +~/check_test_case.sh # does the test case passes ? +$ git bisect start HEAD HEAD~10 -- # culprit is among the last 10 +$ git bisect run ~/test.sh +------------ ++ +Here "check_test_case.sh" should "exit 0", if the test case passes, +and "exit 1" (for example) otherwise. ++ +It's safer if both "test.sh" and "check_test_case.sh" scripts are +outside the repo to prevent interactions between the bisect, make and +test processes and the scripts. + Author ------ Written by Linus Torvalds @@ -227,4 +282,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt index 14163b65f9..8f4fb46685 100644 --- a/Documentation/git-blame.txt +++ b/Documentation/git-blame.txt @@ -52,12 +52,14 @@ include::blame-options.txt[] a certain threshold for git-blame to consider those lines of code to have been moved. --f, --show-name:: +-f:: +--show-name:: Show filename in the original commit. By default filename is shown if there is any line that came from a file with different name, due to rename detection. --n, --show-number:: +-n:: +--show-number:: Show line number in the original commit (Default: off). -s:: @@ -192,4 +194,4 @@ Written by Junio C Hamano GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt index 6f07a17a2c..0fd58083eb 100644 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@ -8,7 +8,7 @@ git-branch - List, create, or delete branches SYNOPSIS -------- [verse] -'git-branch' [--color | --no-color] [-r | -a] +'git-branch' [--color | --no-color] [-r | -a] [--merged | --no-merged] [-v [--abbrev= | --no-abbrev]] [--contains ] 'git-branch' [--track | --no-track] [-l] [-f] [] @@ -24,6 +24,8 @@ and option `-a` shows both. With `--contains `, shows only the branches that contains the named commit (in other words, the branches whose tip commits are descendant of the named commit). +With `--merged`, only branches merged into HEAD will be listed, and +with `--no-merged` only branches not merged into HEAD will be listed. In its second form, a new branch named will be created. It will start out with a head equal to the one given as . @@ -93,7 +95,8 @@ OPTIONS -a:: List both remote-tracking branches and local branches. --v, --verbose:: +-v:: +--verbose:: Show sha1 and commit subject line for each head. --abbrev=:: @@ -118,6 +121,15 @@ OPTIONS --no-track:: Ignore the branch.autosetupmerge configuration variable. +--contains :: + Only list branches which contain the specified commit. + +--merged:: + Only list branches which are fully contained by HEAD. + +--no-merged:: + Do not list branches which are fully contained by HEAD. + :: The name of the branch to create or delete. The new branch name must pass all checks defined by @@ -175,6 +187,18 @@ If you are creating a branch that you want to immediately checkout, it's easier to use the git checkout command with its `-b` option to create a branch and check it out with a single command. +The options `--contains`, `--merged` and `--no-merged` serves three related +but different purposes: + +- `--contains ` is used to find all branches which will need + special attention if were to be rebased or amended, since those + branches contain the specified . + +- `--merged` is used to find all branches which can be safely deleted, + since those branches are fully contained by HEAD. + +- `--no-merged` is used to find branches which are candidates for merging + into HEAD, since those branches are not fully contained by HEAD. Author ------ @@ -186,4 +210,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-bundle.txt b/Documentation/git-bundle.txt index 18330cdcd2..f6a06129ab 100644 --- a/Documentation/git-bundle.txt +++ b/Documentation/git-bundle.txt @@ -171,4 +171,4 @@ Written by Mark Levedahl GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt index df42cb10f2..f58013ca60 100644 --- a/Documentation/git-cat-file.txt +++ b/Documentation/git-cat-file.txt @@ -8,13 +8,18 @@ git-cat-file - Provide content or type/size information for repository objects SYNOPSIS -------- +[verse] 'git-cat-file' [-t | -s | -e | -p | ] +'git-cat-file' [--batch | --batch-check] < DESCRIPTION ----------- -Provides content or type of objects in the repository. The type -is required unless '-t' or '-p' is used to find the object type, -or '-s' is used to find the object size. +In the first form, provides content or type of objects in the repository. The +type is required unless '-t' or '-p' is used to find the object type, or '-s' +is used to find the object size. + +In the second form, a list of object (separated by LFs) is provided on stdin, +and the SHA1, type, and size of each object is printed on stdout. OPTIONS ------- @@ -46,6 +51,14 @@ OPTIONS or to ask for a "blob" with being a tag object that points at it. +--batch:: + Print the SHA1, type, size, and contents of each object provided on + stdin. May not be combined with any other options or arguments. + +--batch-check:: + Print the SHA1, type, and size of each object provided on stdin. May not be + combined with any other options or arguments. + OUTPUT ------ If '-t' is specified, one of the . @@ -56,9 +69,30 @@ If '-e' is specified, no output. If '-p' is specified, the contents of are pretty-printed. -Otherwise the raw (though uncompressed) contents of the will -be returned. +If is specified, the raw (though uncompressed) contents of the +will be returned. + +If '--batch' is specified, output of the following form is printed for each +object specified on stdin: + +------------ + SP SP LF + LF +------------ + +If '--batch-check' is specified, output of the following form is printed for +each object specified fon stdin: + +------------ + SP SP LF +------------ + +For both '--batch' and '--batch-check', output of the following form is printed +for each object specified on stdin that does not exist in the repository: +------------ + SP missing LF +------------ Author ------ @@ -70,4 +104,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index e11cddbfc9..3ad9760a4d 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -47,6 +47,7 @@ OPTIONS by linkgit:git-check-ref-format[1]. Some of these checks may restrict the characters allowed in a branch name. +-t:: --track:: When creating a new branch, set up configuration so that git-pull will automatically retrieve data from the start point, which must be @@ -215,4 +216,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt index f0beb412e6..5ac9cfb0ef 100644 --- a/Documentation/git-cherry-pick.txt +++ b/Documentation/git-cherry-pick.txt @@ -7,7 +7,7 @@ git-cherry-pick - Apply the change introduced by an existing commit SYNOPSIS -------- -'git-cherry-pick' [--edit] [-n] [-m parent-number] [-x] +'git-cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] DESCRIPTION ----------- @@ -22,7 +22,8 @@ OPTIONS For a more complete list of ways to spell commits, see "SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1]. --e|--edit:: +-e:: +--edit:: With this option, `git-cherry-pick` will let you edit the commit message prior to committing. @@ -44,14 +45,16 @@ OPTIONS described above, and `-r` was to disable it. Now the default is not to do `-x` so this option is a no-op. --m parent-number|--mainline parent-number:: +-m parent-number:: +--mainline parent-number:: Usually you cannot cherry-pick a merge because you do not know which side of the merge should be considered the mainline. This option specifies the parent number (starting from 1) of the mainline and allows cherry-pick to replay the change relative to the specified parent. --n|--no-commit:: +-n:: +--no-commit:: Usually the command automatically creates a commit with a commit log message stating which commit was cherry-picked. This flag applies the change necessary @@ -64,6 +67,10 @@ OPTIONS This is useful when cherry-picking more than one commits' effect to your working tree in a row. +-s:: +--signoff:: + Add Signed-off-by line at the end of the commit message. + Author ------ @@ -75,4 +82,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-cherry.txt b/Documentation/git-cherry.txt index b0468aa746..ef7caf61e1 100644 --- a/Documentation/git-cherry.txt +++ b/Documentation/git-cherry.txt @@ -13,6 +13,8 @@ DESCRIPTION ----------- The changeset (or "diff") of each commit between the fork-point and is compared against each commit between the fork-point and . +The commits are compared with their 'patch id', obtained from linkgit:git-patch-id[1] +program. Every commit that doesn't exist in the branch has its id (sha1) reported, prefixed by a symbol. The ones that have @@ -56,6 +58,10 @@ OPTIONS :: Do not report commits up to (and including) limit. +SEE ALSO +-------- +linkgit:git-patch-id[1] + Author ------ Written by Junio C Hamano @@ -66,4 +72,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-citool.txt b/Documentation/git-citool.txt index aca1d75e50..09108d0e66 100644 --- a/Documentation/git-citool.txt +++ b/Documentation/git-citool.txt @@ -29,4 +29,4 @@ Documentation by Shawn O. Pearce . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt index 5e9da036ba..37a82ee4b8 100644 --- a/Documentation/git-clean.txt +++ b/Documentation/git-clean.txt @@ -30,9 +30,11 @@ OPTIONS git-clean will refuse to run unless given -f or -n. -n:: +--dry-run:: Don't actually remove anything, just show what would be done. -q:: +--quiet:: Be quiet, only report errors, but not the files that are successfully removed. @@ -54,4 +56,4 @@ Written by Pavel Roskin GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt index 9b564420c5..7973e6af4c 100644 --- a/Documentation/git-clone.txt +++ b/Documentation/git-clone.txt @@ -205,4 +205,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt index 170803a6d0..728c2fae89 100644 --- a/Documentation/git-commit-tree.txt +++ b/Documentation/git-commit-tree.txt @@ -88,7 +88,7 @@ Discussion include::i18n.txt[] -See Also +SEE ALSO -------- linkgit:git-write-tree[1] @@ -103,4 +103,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list | -F | -m | --amend] - [--allow-empty] [--no-verify] [-e] [--author ] +'git-commit' [-a | --interactive] [-s] [-v] [-u] [--amend] + [(-c | -C) ] [-F | -m ] + [--allow-empty] [--no-verify] [-e] [--author=] [--cleanup=] [--] [[-i | -o ]...] DESCRIPTION @@ -52,42 +52,52 @@ that, you can recover from it with linkgit:git-reset[1]. OPTIONS ------- --a|--all:: +-a:: +--all:: Tell the command to automatically stage files that have been modified and deleted, but new files you have not told git about are not affected. --c or -C :: - Take existing commit object, and reuse the log message +-C :: +--reuse-message=:: + Take an existing commit object, and reuse the log message and the authorship information (including the timestamp) - when creating the commit. With '-C', the editor is not - invoked; with '-c' the user can further edit the commit - message. + when creating the commit. + +-c :: +--reedit-message=:: + Like '-C', but with '-c' the editor is invoked, so that + the user can further edit the commit message. -F :: +--file=:: Take the commit message from the given file. Use '-' to read the message from the standard input. ---author :: +--author=:: Override the author name used in the commit. Use `A U Thor ` format. --m |--message=:: +-m :: +--message=:: Use the given as the commit message. --t |--template=:: +-t :: +--template=:: Use the contents of the given file as the initial version of the commit message. The editor is invoked and you can make subsequent changes. If a message is specified using the `-m` or `-F` options, this option has no effect. This overrides the `commit.template` configuration variable. --s|--signoff:: +-s:: +--signoff:: Add Signed-off-by line at the end of the commit message. +-n:: --no-verify:: This option bypasses the pre-commit and commit-msg hooks. - See also link:hooks.html[hooks]. + See also linkgit:githooks[5][hooks]. --allow-empty:: Usually recording a commit that has the exact same tree as its @@ -105,14 +115,14 @@ OPTIONS 'whitespace' removes just leading/trailing whitespace lines and 'strip' removes both whitespace and commentary. --e|--edit:: +-e:: +--edit:: The message taken from file with `-F`, command line with `-m`, and from file with `-C` are usually used as the commit log message unmodified. This option lets you further edit the message taken from these sources. --amend:: - Used to amend the tip of the current branch. Prepare the tree object you would want to replace the latest commit as usual (this includes the usual -i/-o and explicit paths), and the @@ -133,13 +143,15 @@ It is a rough equivalent for: but can be used to amend a merge commit. -- --i|--include:: +-i:: +--include:: Before making a commit out of staged contents so far, stage the contents of paths given on the command line as well. This is usually not what you want unless you are concluding a conflicted merge. --o|--only:: +-o:: +--only:: Make a commit only from the paths specified on the command line, disregarding any contents that have been staged so far. This is the default mode of operation of @@ -150,20 +162,23 @@ but can be used to amend a merge commit. the last commit without committing changes that have already been staged. --u|--untracked-files:: +-u:: +--untracked-files:: Show all untracked files, also those in uninteresting directories, in the "Untracked files:" section of commit message template. Without this option only its name and a trailing slash are displayed for each untracked directory. --v|--verbose:: +-v:: +--verbose:: Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message template. Note that this diff output doesn't have its lines prefixed with '#'. --q|--quiet:: +-q:: +--quiet:: Suppress commit summary message. \--:: @@ -292,7 +307,7 @@ order). HOOKS ----- This command can run `commit-msg`, `prepare-commit-msg`, `pre-commit`, -and `post-commit` hooks. See link:hooks.html[hooks] for more +and `post-commit` hooks. See linkgit:githooks[5][hooks] for more information. @@ -312,4 +327,4 @@ Junio C Hamano GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt index fa161718dd..c90421ee7f 100644 --- a/Documentation/git-config.txt +++ b/Documentation/git-config.txt @@ -101,7 +101,8 @@ rather than from all available files. + See also <>. --f config-file, --file config-file:: +-f config-file:: +--file config-file:: Use the given config file instead of the one specified by GIT_CONFIG. --remove-section:: @@ -116,7 +117,8 @@ See also <>. --unset-all:: Remove all lines matching the key from config file. --l, --list:: +-l:: +--list:: List all variables set in config file. --bool:: @@ -128,7 +130,8 @@ See also <>. in the config file will cause the value to be multiplied by 1024, 1048576, or 1073741824 prior to output. --z, --null:: +-z:: +--null:: For all options that output values and/or keys, always end values with the null character (instead of a newline). Use newline instead as a delimiter between @@ -144,6 +147,8 @@ See also <>. "auto". If `stdout-is-tty` is missing, then checks the standard output of the command itself, and exits with status 0 if color is to be used, or exits with status 1 otherwise. + When the color setting for `name` is undefined, the command uses + `color.ui` as fallback. --get-color name default:: @@ -332,4 +337,4 @@ Documentation by Johannes Schindelin, Petr Baudis and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-cvsexportcommit.txt b/Documentation/git-cvsexportcommit.txt index 9a47b4c397..5fa91e51ad 100644 --- a/Documentation/git-cvsexportcommit.txt +++ b/Documentation/git-cvsexportcommit.txt @@ -8,7 +8,7 @@ git-cvsexportcommit - Export a single commit to a CVS checkout SYNOPSIS -------- -'git-cvsexportcommit' [-h] [-u] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-w cvsworkdir] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID +'git-cvsexportcommit' [-h] [-u] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-w cvsworkdir] [-W] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID DESCRIPTION @@ -65,11 +65,22 @@ OPTIONS -w:: Specify the location of the CVS checkout to use for the export. This option does not require GIT_DIR to be set before execution if the - current directory is within a git repository. + current directory is within a git repository. The default is the + value of 'cvsexportcommit.cvsdir'. + +-W:: + Tell cvsexportcommit that the current working directory is not only + a Git checkout, but also the CVS checkout. Therefore, Git will + reset the working directory to the parent commit before proceeding. -v:: Verbose. +CONFIGURATION +------------- +cvsexportcommit.cvsdir:: + The default location of the CVS checkout to use for the export. + EXAMPLES -------- @@ -106,4 +117,4 @@ Documentation by Martin Langhoff and others. GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt index 58eefd42e5..93b7d2dc99 100644 --- a/Documentation/git-cvsimport.txt +++ b/Documentation/git-cvsimport.txt @@ -31,6 +31,12 @@ to work with; after that, you need to 'git merge' incremental imports, or any CVS branches, yourself. It is advisable to specify a named remote via -r to separate and protect the incoming branches. +If you intend to set up a shared public repository that all developers can +read/write, or if you want to use linkgit:git-cvsserver[1], then you +probably want to make a bare clone of the imported repository, +and use the clone as the shared repository. +See linkgit:gitcvs-migration[7]. + OPTIONS ------- @@ -170,4 +176,4 @@ Documentation by Matthias Urlichs . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt index b1106714b2..19da87e71d 100644 --- a/Documentation/git-cvsserver.txt +++ b/Documentation/git-cvsserver.txt @@ -41,10 +41,13 @@ Don't allow recursing into subdirectories Don't check for `gitcvs.enabled` in config. You also have to specify a list of allowed directories (see below) if you want to use this option. ---version, -V:: +-V:: +--version:: Print version information and exit ---help, -h, -H:: +-h:: +-H:: +--help:: Print usage information and exit :: @@ -130,6 +133,9 @@ write access to the log file and to the database (see <>. If you want to offer write access over SSH, the users of course also need write access to the git repository itself. +You also need to ensure that each repository is "bare" (without a git index +file) for `cvs commit` to work. See linkgit:gitcvs-migration[7]. + [[configaccessmethod]] All configuration variables can also be overridden for a specific method of access. Valid method names are "ext" (for SSH access) and "pserver". The @@ -301,11 +307,33 @@ checkout, diff, status, update, log, add, remove, commit. Legacy monitoring operations are not supported (edit, watch and related). Exports and tagging (tags and branches) are not supported at this stage. -The server should set the '-k' mode to binary when relevant, however, -this is not really implemented yet. For now, you can force the server -to set '-kb' for all files by setting the `gitcvs.allbinary` config -variable. In proper GIT tradition, the contents of the files are -always respected. No keyword expansion or newline munging is supported. +CRLF Line Ending Conversions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +By default the server leaves the '-k' mode blank for all files, +which causes the cvs client to treat them as a text files, subject +to crlf conversion on some platforms. + +You can make the server use `crlf` attributes to set the '-k' modes +for files by setting the `gitcvs.usecrlfattr` config variable. +In this case, if `crlf` is explicitly unset ('-crlf'), then the +server will set '-kb' mode for binary files. If `crlf` is set, +then the '-k' mode will explicitly be left blank. See +also linkgit:gitattributes[5] for more information about the `crlf` +attribute. + +Alternatively, if `gitcvs.usecrlfattr` config is not enabled +or if the `crlf` attribute is unspecified for a filename, then +the server uses the `gitcvs.allbinary` config for the default setting. +If `gitcvs.allbinary` is set, then file not otherwise +specified will default to '-kb' mode. Otherwise the '-k' mode +is left blank. But if `gitcvs.allbinary` is set to "guess", then +the correct '-k' mode will be guessed based on the contents of +the file. + +For best consistency with cvs, it is probably best to override the +defaults by setting `gitcvs.usecrlfattr` to true, +and `gitcvs.allbinary` to "guess". Dependencies ------------ @@ -330,4 +358,4 @@ Documentation by Martyn Smith , Martin Langhoff . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt index 69e1ab750d..9f6f483186 100644 --- a/Documentation/git-describe.txt +++ b/Documentation/git-describe.txt @@ -70,6 +70,9 @@ OPTIONS Only consider tags matching the given pattern (can be used to avoid leaking private tags made from the repository). +--always:: + Show uniquely abbreviated commit object as fallback. + EXAMPLES -------- @@ -142,4 +145,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list ] [...] +'git-diff-files' [-q] [-0|-1|-2|-3|-c|--cc] [] [...] DESCRIPTION ----------- @@ -30,15 +30,13 @@ The default is to diff against our branch (-2) and the cleanly resolved paths. The option -0 can be given to omit diff output for unmerged entries and just show "Unmerged". --c,--cc:: +-c:: +--cc:: This compares stage 2 (our branch), stage 3 (their branch) and the working tree file and outputs a combined diff, similar to the way 'diff-tree' shows a merge commit with these flags. ---no-index:: - Compare the two given files / directories. - -q:: Remain silent even on nonexistent files @@ -57,4 +55,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-fast-export.txt b/Documentation/git-fast-export.txt index 6dac475a0b..332346cc5d 100644 --- a/Documentation/git-fast-export.txt +++ b/Documentation/git-fast-export.txt @@ -80,4 +80,4 @@ Documentation by Johannes E. Schindelin . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index c29a4f8126..395c055f95 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -1119,4 +1119,4 @@ Documentation by Shawn O. Pearce . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt index 57598eb056..282fcaf17f 100644 --- a/Documentation/git-fetch-pack.txt +++ b/Documentation/git-fetch-pack.txt @@ -28,30 +28,32 @@ have a common ancestor commit. OPTIONS ------- -\--all:: +--all:: Fetch all remote refs. -\--quiet, \-q:: +-q:: +--quiet:: Pass '-q' flag to 'git-unpack-objects'; this makes the cloning process less verbose. -\--keep, \-k:: +-k:: +--keep:: Do not invoke 'git-unpack-objects' on received data, but create a single packfile out of it instead, and store it in the object database. If provided twice then the pack is locked against repacking. -\--thin:: +--thin:: Spend extra cycles to minimize the number of objects to be sent. Use it on slower connection. -\--include-tag:: +--include-tag:: If the remote side supports it, annotated tags objects will be downloaded on the same connection as the other objects if the object the tag references is downloaded. The caller must otherwise determine the tags this option made available. -\--upload-pack=:: +--upload-pack=:: Use this to specify the path to 'git-upload-pack' on the remote side, if is not found on your $PATH. Installations of sshd ignores the user's environment @@ -63,16 +65,16 @@ OPTIONS shells by having a lean .bashrc file (they set most of the things up in .bash_profile). -\--exec=:: +--exec=:: Same as \--upload-pack=. -\--depth=:: +--depth=:: Limit fetching to ancestor-chains not longer than n. -\--no-progress:: +--no-progress:: Do not show the progress. -\-v:: +-v:: Run verbosely. :: @@ -99,4 +101,4 @@ Documentation by Junio C Hamano. GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt index d982f961fc..489b2b17e6 100644 --- a/Documentation/git-fetch.txt +++ b/Documentation/git-fetch.txt @@ -53,4 +53,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list :: Only look at the history which touches the given subdirectory. @@ -155,7 +161,8 @@ definition impossible to preserve signatures at any rate.) does this in the '.git-rewrite/' directory but you can override that choice by this parameter. --f|--force:: +-f:: +--force:: `git filter-branch` refuses to start with an existing temporary directory or when there are already refs starting with 'refs/original/', unless forced. @@ -311,4 +318,4 @@ Documentation by Petr Baudis and the git list. GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt index 8615ae353e..2a7cfb980b 100644 --- a/Documentation/git-fmt-merge-msg.txt +++ b/Documentation/git-fmt-merge-msg.txt @@ -9,8 +9,8 @@ git-fmt-merge-msg - Produce a merge commit message SYNOPSIS -------- [verse] -git-fmt-merge-msg [--summary | --no-summary] <$GIT_DIR/FETCH_HEAD -git-fmt-merge-msg [--summary | --no-summary] -F +git-fmt-merge-msg [--log | --no-log] <$GIT_DIR/FETCH_HEAD +git-fmt-merge-msg [--log | --no-log] -F DESCRIPTION ----------- @@ -24,26 +24,36 @@ automatically invoking `git-merge`. OPTIONS ------- ---summary:: +--log:: In addition to branch names, populate the log message with one-line descriptions from the actual commits that are being merged. ---no-summary:: +--no-log:: Do not list one-line descriptions from the actual commits being merged. ---file , -F :: +--summary:: +--no-summary:: + Synonyms to --log and --no-log; these are deprecated and will be + removed in the future. + +-F :: +--file :: Take the list of merged objects from instead of stdin. CONFIGURATION ------------- -merge.summary:: +merge.log:: Whether to include summaries of merged commits in newly merge commit messages. False by default. +merge.summary:: + Synonym to `merge.log`; this is deprecated and will be removed in + the future. + SEE ALSO -------- linkgit:git-merge[1] @@ -59,4 +69,4 @@ Documentation by Petr Baudis, Junio C Hamano and the git-list :: Limits the number of patches to prepare. --o|--output-directory :: +-o :: +--output-directory :: Use to store the resulting files, instead of the current working directory. --n|--numbered:: +-n:: +--numbered:: Name output in '[PATCH n/m]' format. --N|--no-numbered:: +-N:: +--no-numbered:: Name output in '[PATCH]' format. --start-number :: @@ -92,11 +95,13 @@ include::diff-options.txt[] without the default first line of the commit appended. Mutually exclusive with the --stdout option. --k|--keep-subject:: +-k:: +--keep-subject:: Do not strip/add '[PATCH]' from the first line of the commit log message. --s|--signoff:: +-s:: +--signoff:: Add `Signed-off-by:` line to the commit message, using the committer identity of yourself. @@ -156,6 +161,12 @@ want a filename like `0001-description-of-my-change.patch`, and the first letter does not have to be a dot. Leaving it empty would not add any suffix. +--no-binary:: + Don't output contents of changes in binary files, just take note + that they differ. Note that this disable the patch to be properly + applied. By default the contents of changes in those files are + encoded in the patch. + CONFIGURATION ------------- You can specify extra mail header lines to be added to each message @@ -168,40 +179,56 @@ and file suffix, and number patches when outputting more than one. subjectprefix = CHANGE suffix = .txt numbered = auto + cc = ------------ EXAMPLES -------- -git-format-patch -k --stdout R1..R2 | git-am -3 -k:: - Extract commits between revisions R1 and R2, and apply - them on top of the current branch using `git-am` to - cherry-pick them. - -git-format-patch origin:: - Extract all commits which are in the current branch but - not in the origin branch. For each commit a separate file - is created in the current directory. - -git-format-patch \--root origin:: - Extract all commits that lead to 'origin' since the - inception of the project. - -git-format-patch -M -B origin:: - The same as the previous one. Additionally, it detects - and handles renames and complete rewrites intelligently to - produce a renaming patch. A renaming patch reduces the - amount of text output, and generally makes it easier to - review it. Note that the "patch" program does not - understand renaming patches, so use it only when you know - the recipient uses git to apply your patch. - -git-format-patch -3:: - Extract three topmost commits from the current branch - and format them as e-mailable patches. - -See Also +* Extract commits between revisions R1 and R2, and apply them on top of +the current branch using `git-am` to cherry-pick them: ++ +------------ +$ git format-patch -k --stdout R1..R2 | git-am -3 -k +------------ + +* Extract all commits which are in the current branch but not in the +origin branch: ++ +------------ +$ git format-patch origin +------------ ++ +For each commit a separate file is created in the current directory. + +* Extract all commits that lead to 'origin' since the inception of the +project: ++ +------------ +$ git format-patch \--root origin +------------ + +* The same as the previous one: ++ +------------ +$ git format-patch -M -B origin +------------ ++ +Additionally, it detects and handles renames and complete rewrites +intelligently to produce a renaming patch. A renaming patch reduces +the amount of text output, and generally makes it easier to review it. +Note that the "patch" program does not understand renaming patches, so +use it only when you know the recipient uses git to apply your patch. + +* Extract three topmost commits from the current branch and format them +as e-mailable patches: ++ +------------ +$ git format-patch -3 +------------ + +SEE ALSO -------- linkgit:git-am[1], linkgit:git-send-email[1] @@ -216,4 +243,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-fsck.txt b/Documentation/git-fsck.txt index f16cb98612..9846c859cf 100644 --- a/Documentation/git-fsck.txt +++ b/Documentation/git-fsck.txt @@ -22,7 +22,8 @@ OPTIONS An object to treat as the head of an unreachability trace. + If no objects are given, git-fsck defaults to using the -index file and all SHA1 references in .git/refs/* as heads. +index file, all SHA1 references in .git/refs/*, and all reflogs (unless +--no-reflogs is given) as heads. --unreachable:: Print out objects that exist but that aren't readable from any @@ -150,4 +151,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-get-tar-commit-id.txt b/Documentation/git-get-tar-commit-id.txt index dea41490c4..c13bf98697 100644 --- a/Documentation/git-get-tar-commit-id.txt +++ b/Documentation/git-get-tar-commit-id.txt @@ -33,4 +33,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt index a97f0557f4..1b646b73f0 100644 --- a/Documentation/git-grep.txt +++ b/Documentation/git-grep.txt @@ -33,25 +33,30 @@ OPTIONS Instead of searching in the working tree files, check the blobs registered in the index file. --a | --text:: +-a:: +--text:: Process binary files as if they were text. --i | --ignore-case:: +-i:: +--ignore-case:: Ignore case differences between the patterns and the files. -I:: Don't match the pattern in binary files. --w | --word-regexp:: +-w:: +--word-regexp:: Match the pattern only at word boundary (either begin at the beginning of a line, or preceded by a non-word character; end at the end of a line or followed by a non-word character). --v | --invert-match:: +-v:: +--invert-match:: Select non-matching lines. --h | -H:: +-h:: +-H:: By default, the command shows the filename for each match. `-h` option is used to suppress this output. `-H` is there for completeness and does not do anything @@ -64,24 +69,33 @@ OPTIONS option forces paths to be output relative to the project top directory. --E | --extended-regexp | -G | --basic-regexp:: +-E:: +--extended-regexp:: +-G:: +--basic-regexp:: Use POSIX extended/basic regexp for patterns. Default is to use basic regexp. --F | --fixed-strings:: +-F:: +--fixed-strings:: Use fixed strings for patterns (don't interpret pattern as a regex). -n:: Prefix the line number to matching lines. --l | --files-with-matches | --name-only | -L | --files-without-match:: +-l:: +--files-with-matches:: +--name-only:: +-L:: +--files-without-match:: Instead of showing every matched line, show only the names of files that contain (or do not contain) matches. For better compatibility with git-diff, --name-only is a synonym for --files-with-matches. --c | --count:: +-c:: +--count:: Instead of showing every matched line, show the number of lines that match. @@ -103,7 +117,10 @@ OPTIONS scripts passing user input to grep. Multiple patterns are combined by 'or'. ---and | --or | --not | ( | ):: +--and:: +--or:: +--not:: +( ... ):: Specify how multiple patterns are combined using Boolean expressions. `--or` is the default operator. `--and` has higher precedence than `--or`. `-e` has to be used for all @@ -145,4 +162,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-gui.txt b/Documentation/git-gui.txt index 6d6cd5d87c..105397f2bd 100644 --- a/Documentation/git-gui.txt +++ b/Documentation/git-gui.txt @@ -79,9 +79,9 @@ git gui browser maint:: selected in the browser can be viewed with the internal blame viewer. -See Also +SEE ALSO -------- -'gitk(1)':: +linkgit:gitk[1]:: The git repository browser. Shows branches, commit history and file differences. gitk is the utility started by git-gui's Repository Visualize actions. @@ -112,4 +112,4 @@ Documentation by Shawn O. Pearce . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-hash-object.txt b/Documentation/git-hash-object.txt index 33030c022f..cf3dce8a4a 100644 --- a/Documentation/git-hash-object.txt +++ b/Documentation/git-hash-object.txt @@ -8,7 +8,7 @@ git-hash-object - Compute object ID and optionally creates a blob from a file SYNOPSIS -------- -'git-hash-object' [-t ] [-w] [--stdin] [--] ... +'git-hash-object' [-t ] [-w] [--stdin | --stdin-paths] [--] ... DESCRIPTION ----------- @@ -32,6 +32,9 @@ OPTIONS --stdin:: Read the object from standard input instead of from a file. +--stdin-paths:: + Read file names from stdin instead of from the command-line. + Author ------ Written by Junio C Hamano @@ -42,4 +45,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list .cmd' configuration entry (see below). + +Multiple values may be given to the 'man.viewer' configuration +variable. Their corresponding programs will be tried in the order +listed in the configuration file. For example, this configuration: +------------------------------------------------ [man] viewer = konqueror viewer = woman +------------------------------------------------ will try to use konqueror first. But this may fail (for example if DISPLAY is not set) and in that case emacs' woman mode will be tried. If everything fails the 'man' program will be tried anyway. +man..path +~~~~~~~~~~~~~~~ + +You can explicitly provide a full path to your preferred man viewer by +setting the configuration variable 'man..path'. For example, you +can configure the absolute path to konqueror by setting +'man.konqueror.path'. Otherwise, 'git help' assumes the tool is +available in PATH. + +man..cmd +~~~~~~~~~~~~~~ + +When the man viewer, specified by the 'man.viewer' configuration +variables, is not among the supported ones, then the corresponding +'man..cmd' configuration variable will be looked up. If this +variable exists then the specified tool will be treated as a custom +command and a shell eval will be used to run the command with the man +page passed as arguments. + +Note about konqueror +~~~~~~~~~~~~~~~~~~~~ + +When 'konqueror' is specified in the 'man.viewer' configuration +variable, we launch 'kfmclient' to try to open the man page on an +already opened konqueror in a new tab if possible. + +For consistency, we also try such a trick if 'man.konqueror.path' is +set to something like 'A_PATH_TO/konqueror'. That means we will try to +launch 'A_PATH_TO/kfmclient' instead. + +If you really want to use 'konqueror', then you can use something like +the following: + +------------------------------------------------ + [man] + viewer = konq + + [man "konq"] + cmd = A_PATH_TO/konqueror +------------------------------------------------ + Note about git config --global ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -125,10 +176,10 @@ Written by Junio C Hamano and the git-list Documentation ------------- -Initial documentation was part of the linkgit:git[7] man page. +Initial documentation was part of the linkgit:git[1] man page. Christian Couder extracted and rewrote it a little. Maintenance is done by the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-http-fetch.txt b/Documentation/git-http-fetch.txt index b784a9d07e..70fb635291 100644 --- a/Documentation/git-http-fetch.txt +++ b/Documentation/git-http-fetch.txt @@ -53,4 +53,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list from remote repository. The specified branch cannot be the remote HEAD. If -d is specified the following other conditions must also be met: @@ -101,4 +102,4 @@ Documentation by Nick Hengeveld GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-imap-send.txt b/Documentation/git-imap-send.txt index 522b73c12f..f4fdc24283 100644 --- a/Documentation/git-imap-send.txt +++ b/Documentation/git-imap-send.txt @@ -59,4 +59,4 @@ Documentation by Mike McCormack GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-index-pack.txt b/Documentation/git-index-pack.txt index a7825b6144..6409363ae5 100644 --- a/Documentation/git-index-pack.txt +++ b/Documentation/git-index-pack.txt @@ -100,4 +100,4 @@ Documentation by Sergey Vlasov GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt index 62914da97b..792643c809 100644 --- a/Documentation/git-init.txt +++ b/Documentation/git-init.txt @@ -8,7 +8,7 @@ git-init - Create an empty git repository or reinitialize an existing one SYNOPSIS -------- -'git-init' [-q | --quiet] [--template=] [--shared[=]] +'git-init' [-q | --quiet] [--bare] [--template=] [--shared[=]] OPTIONS @@ -16,10 +16,16 @@ OPTIONS -- --q, \--quiet:: +-q:: +--quiet:: Only print error and warning messages, all other output will be suppressed. +--bare:: + +Create a bare repository. If GIT_DIR environment is not set, it is set to the +current working directory. + --template=:: Provide the directory from which templates will be used. The default template @@ -31,7 +37,7 @@ structure, some suggested "exclude patterns", and copies of non-executing "hook" files. The suggested patterns and hook files are all modifiable and extensible. ---shared[={false|true|umask|group|all|world|everybody}]:: +--shared[={false|true|umask|group|all|world|everybody|0xxx}]:: Specify that the git repository is to be shared amongst several users. This allows users belonging to the same group to push into that @@ -52,6 +58,12 @@ is given: - 'all' (or 'world' or 'everybody'): Same as 'group', but make the repository readable by all users. + - '0xxx': '0xxx' is an octal number and each file will have mode '0xxx' + Any option except 'umask' can be set using this option. '0xxx' will + override users umask(2) value, and thus, users with a safe umask (0077) + can use this option. '0640' will create a repository which is group-readable + but not writable. '0660' is equivalent to 'group'. + By default, the configuration flag receive.denyNonFastForwards is enabled in shared repositories, so that you cannot force a non fast-forwarding push into it. @@ -111,4 +123,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index ebaee4b334..db61bc96c7 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -112,4 +112,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt index da9ebf405c..560594e25f 100644 --- a/Documentation/git-ls-files.txt +++ b/Documentation/git-ls-files.txt @@ -30,23 +30,29 @@ shown: OPTIONS ------- --c|--cached:: +-c:: +--cached:: Show cached files in the output (default) --d|--deleted:: +-d:: +--deleted:: Show deleted files in the output --m|--modified:: +-m:: +--modified:: Show modified files in the output --o|--others:: +-o:: +--others:: Show other files in the output --i|--ignored:: +-i:: +--ignored:: Show ignored files in the output. Note that this also reverses any exclude list present. --s|--stage:: +-s:: +--stage:: Show stage files in the output --directory:: @@ -56,10 +62,12 @@ OPTIONS --no-empty-directory:: Do not list empty directories. Has no effect without --directory. --u|--unmerged:: +-u:: +--unmerged:: Show unmerged files in the output (forces --stage) --k|--killed:: +-k:: +--killed:: Show files on the filesystem that need to be removed due to file/directory conflicts for checkout-index to succeed. @@ -67,11 +75,13 @@ OPTIONS -z:: \0 line termination on output. --x|--exclude=:: +-x :: +--exclude=:: Skips files matching pattern. Note that pattern is a shell wildcard pattern. --X|--exclude-from=:: +-X :: +--exclude-from=:: exclude patterns are read from ; 1 per line. --exclude-per-directory=:: @@ -177,7 +187,7 @@ top of the directory tree. A pattern read from a file specified by --exclude-per-directory is relative to the directory that the pattern file appears in. -See Also +SEE ALSO -------- linkgit:git-read-tree[1], linkgit:gitignore[5] @@ -192,4 +202,4 @@ Documentation by David Greaves, Junio C Hamano, Josh Triplett, and the git-list GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt index c5ba0aad13..f92f3ca186 100644 --- a/Documentation/git-ls-remote.txt +++ b/Documentation/git-ls-remote.txt @@ -20,13 +20,17 @@ commit IDs. OPTIONS ------- --h|--heads, -t|--tags:: +-h:: +--heads:: +-t:: +--tags:: Limit to only refs/heads and refs/tags, respectively. These options are _not_ mutually exclusive; when given both, references stored in refs/heads and refs/tags are displayed. --u , --upload-pack=:: +-u :: +--upload-pack=:: Specify the full path of linkgit:git-upload-pack[1] on the remote host. This allows listing references from repositories accessed via SSH and where the SSH daemon does not use the PATH configured by the @@ -69,4 +73,4 @@ Written by Junio C Hamano GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-ls-tree.txt b/Documentation/git-ls-tree.txt index 360c0a1b98..d9881fbbbe 100644 --- a/Documentation/git-ls-tree.txt +++ b/Documentation/git-ls-tree.txt @@ -91,4 +91,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-mailinfo.txt b/Documentation/git-mailinfo.txt index 3846f0e6eb..183dc1dd75 100644 --- a/Documentation/git-mailinfo.txt +++ b/Documentation/git-mailinfo.txt @@ -66,4 +66,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-mailsplit.txt b/Documentation/git-mailsplit.txt index 8243f69113..9a2aedd480 100644 --- a/Documentation/git-mailsplit.txt +++ b/Documentation/git-mailsplit.txt @@ -27,7 +27,7 @@ OPTIONS Root of the Maildir to split. This directory should contain the cur, tmp and new subdirectories. -:: +-o:: Directory in which to place the individual messages. -b:: @@ -55,4 +55,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt index 07f78b4ae0..bbe8512397 100644 --- a/Documentation/git-merge-base.txt +++ b/Documentation/git-merge-base.txt @@ -39,4 +39,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index c136b10692..55bc367479 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -9,7 +9,7 @@ git-merge - Join two or more development histories together SYNOPSIS -------- [verse] -'git-merge' [-n] [--summary] [--no-commit] [--squash] [-s ]... +'git-merge' [-n] [--stat] [--no-commit] [--squash] [-s ]... [-m ] ... 'git-merge' HEAD ... @@ -46,18 +46,7 @@ linkgit:git-reset[1]. CONFIGURATION ------------- - -merge.summary:: - Whether to include summaries of merged commits in newly - created merge commit. False by default. - -merge.verbosity:: - Controls the amount of output shown by the recursive merge - strategy. Level 0 outputs nothing except a final error - message if conflicts were detected. Level 1 outputs only - conflicts, 2 outputs conflicts and file changes. Level 5 and - above outputs debugging information. The default is level 2. - Can be overridden by 'GIT_MERGE_VERBOSITY' environment variable. +include::merge-config.txt[] branch..mergeoptions:: Sets default options for merging into branch . The syntax and @@ -179,4 +168,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt index 8ed44947ef..83525609c6 100644 --- a/Documentation/git-mergetool.txt +++ b/Documentation/git-mergetool.txt @@ -70,4 +70,4 @@ Documentation by Theodore Y Ts'o. GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-mktag.txt b/Documentation/git-mktag.txt index 82db9f5d8f..232bc1a338 100644 --- a/Documentation/git-mktag.txt +++ b/Documentation/git-mktag.txt @@ -43,4 +43,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt index bff3fbe745..339190600a 100644 --- a/Documentation/git-mv.txt +++ b/Documentation/git-mv.txt @@ -34,7 +34,8 @@ OPTIONS condition. An error happens when a source is neither existing nor controlled by GIT, or when it would overwrite an existing file unless '-f' is given. --n, \--dry-run:: +-n:: +--dry-run:: Do nothing; only show what would happen @@ -50,4 +51,4 @@ Documentation by David Greaves, Junio C Hamano and the git-list -See Also +SEE ALSO -------- linkgit:git-pack-objects[1] linkgit:git-repack[1] @@ -54,4 +54,4 @@ linkgit:git-prune-packed[1] GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-pack-refs.txt b/Documentation/git-pack-refs.txt index e4ff934711..c0718468d5 100644 --- a/Documentation/git-pack-refs.txt +++ b/Documentation/git-pack-refs.txt @@ -42,7 +42,7 @@ unpacked. OPTIONS ------- -\--all:: +--all:: The command by default packs all tags and refs that are already packed, and leaves other refs @@ -51,7 +51,7 @@ developed and packing their tips does not help performance. This option causes branch tips to be packed as well. Useful for a repository with many branches of historical interests. -\--no-prune:: +--no-prune:: The command usually removes loose refs under `$GIT_DIR/refs` hierarchy after packing them. This option tells it not to. @@ -63,4 +63,4 @@ Written by Linus Torvalds GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-parse-remote.txt b/Documentation/git-parse-remote.txt index deb8b2f01e..951dbd6c83 100644 --- a/Documentation/git-parse-remote.txt +++ b/Documentation/git-parse-remote.txt @@ -47,4 +47,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-patch-id.txt b/Documentation/git-patch-id.txt index 894852a78b..bb8a079254 100644 --- a/Documentation/git-patch-id.txt +++ b/Documentation/git-patch-id.txt @@ -39,4 +39,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-peek-remote.txt b/Documentation/git-peek-remote.txt index 0001710072..ffbf93a799 100644 --- a/Documentation/git-peek-remote.txt +++ b/Documentation/git-peek-remote.txt @@ -16,7 +16,7 @@ This command is deprecated; use `git-ls-remote` instead. OPTIONS ------- -\--upload-pack=:: +--upload-pack=:: Use this to specify the path to 'git-upload-pack' on the remote side, if it is not found on your $PATH. Some installations of sshd ignores the user's environment @@ -47,4 +47,4 @@ Documentation by Junio C Hamano. GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-prune-packed.txt b/Documentation/git-prune-packed.txt index 93ee82ae57..f330b8a5b9 100644 --- a/Documentation/git-prune-packed.txt +++ b/Documentation/git-prune-packed.txt @@ -42,11 +42,11 @@ Documentation -------------- Documentation by Ryan Anderson -See Also +SEE ALSO -------- linkgit:git-pack-objects[1] linkgit:git-repack[1] GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/git-prune.txt b/Documentation/git-prune.txt index f151cff5d9..ec335d6fab 100644 --- a/Documentation/git-prune.txt +++ b/Documentation/git-prune.txt @@ -13,14 +13,20 @@ SYNOPSIS DESCRIPTION ----------- +NOTE: In most cases, users should run linkgit:git-gc[1], which calls +git-prune. See the section "NOTES", below. + This runs `git-fsck --unreachable` using all the refs available in `$GIT_DIR/refs`, optionally with additional set of -objects specified on the command line, and prunes all +objects specified on the command line, and prunes all unpacked objects unreachable from any of these head objects from the object database. In addition, it prunes the unpacked objects that are also found in packs by running `git prune-packed`. +Note that unreachable, packed objects will remain. If this is +not desired, see linkgit:git-repack[1]. + OPTIONS ------- @@ -31,7 +37,7 @@ OPTIONS \--:: Do not interpret any more arguments as options. -\--expire