{"thread":{"id":"418","subject":"Quick command reference","startedAt":"2005-05-01T12:58:14Z","lastAt":"2005-05-06T09:32:30Z","messageCount":16,"participants":["Paul Mackerras","David Greaves","Brian O'Mahoney","Linus Torvalds","Junio C Hamano","H. Peter Anvin","bert hubert","Randy.Dunlap"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"2292","messageId":"17012.53862.704670.858276@cargo.ozlabs.ibm.com","threadId":"418","inReplyTo":null,"subject":"Quick command reference","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2005-05-01T12:58:14Z","receivedAt":"2005-05-01T12:58:14Z","isPatch":false,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"As an aid to my understanding of the core git commands, I created this\nsummary of the commands and their options and parameters.  I hope it\nwill be useful to others.  Corrections welcome of course.\n\nPaul.\n---\n\ngit-cat-file -t sha1-id\n\tPrints type of object with given sha1-id to stdout.\n\ngit-cat-file type sha1-id\n\tCopies contents of object with given sha1-id to stdout.\n\tComplains if type of sha1-id isn't of the type specified.\n\ngit-check-files pathname...\n\tChecks that each pathname given is up-to-date in the w.d.\n\t(i.e. matches the dircache) or is not present.\n\ngit-checkout-cache [-a] [-f] [-q] [-n] [--prefix=path] [--] [files...]\n\tCopies files from the git object repository to the\n\tworking directory or another directory.  Does not rewrite\n\tfiles that already exist and match the dircache.\n\t-a: check out all files listed in dircache.\n\t-f: overwrite existing files; without this, checkout-cache\n\t\twill not overwrite an existing file even if it\n\t\tdiffers from what is in the dircache.\n\t-q: quiet; don't print an error message when a file is\n\t\tunmerged or not in the dircache, or when a file exists\n\t\tbut differs from the dircache and -f was not given.\n\t-n: not new files; don't checkout any file that doesn't\n\t\talready exist in the dircache.\n\t--prefix=path: prepend path to the pathname of each file\n\t\tbeing checked out.  If you want to use this to\n\t\tcheck out files with their normal names but in\n\t\tanother directory, make sure the path ends in /.\n\tThe order of the flags matters; checkout-cache -a -f\n\tis different from checkout-cache -f -a.  Flags may be\n\tinterspersed between file names.\n\ngit-commit-tree tree-id [-p parent-commit-id]* < changelog\n\tGenerates a commit object referring to the given tree with\n\tthe parent commit-ids given.  (If no parents are given, this\n\tis an initial commit.)  Prints the sha1 id of the generated\n\tcommit to stdout.\n\ngit-diff-cache [-r] [-p] [-z] [--cached] tree-id\n\tShow differences between the tree identified by tree-id\n\tand the dircache and/or the working directory.\n\t-r: ignored (old recursive flag)\n\t-p: generate patches (full diff listings)\n\t-z: terminate lines with \\0 instead of \\n\n\t--cached: diff against last cached state rather than\n\t    file in w.d. for new or changed files.  New and changed\n\t    files are always identified by comparing dircache and\n\t    tree entries, but without this flag, the files that are\n\t    identified as new or changed are compared against the\n\t    working directory rather than the cached version.\n\tUnmerged (non-stage 0) entries in dircache are shown as:\n\t\tU <pathname>\n\tor if -p is given, as\n\t\t* Unmerged path pathname\n\tFiles in tree but not in dircache (or w.d., without --cached):\n\t\t-mode<tab>blob<tab>sha1<tab>pathname\n\tor with -p, as a patch deleting the file.\n\tFiles in dircache but not in tree are shown as:\n\t\t+mode<tab>blob<tab>sha1<tab>pathname\n\tor with -p, as a patch adding the file.\n\tFiles that differ are shown as:\n\t\t*mode->mode<tab>blob<tab>sha1->sha1<tab>pathname\n\tor with -p, as a patch showing the differences\n\ngit-diff-files\n\tCompares working-directory with dircache and prints a listing\n\tof changed files.\n\t-p: generate patches (full diff listings)\n\t-q: Silent; don't show files missing from w.d.\n\t-r: ignored (old recursive flag)\n\t-s: ignored (old silent flag)\n\t-z: terminate lines with \\0 instead of \\n\n\tIf no pathnames given, compare all files in dircache.\n\tChecks mode, uid, gid, size, mtime, ctime, dev/ino, size.\n\tOutput is as for git-diff-cache (\"-\" indicates file in\n\tdircache but not in w.d.).\n\ngit-diff-tree [-p] [-r] [-z] tree1-id tree2-id\n\tCompares two trees identified by their ids.\n\t-p: generate patches (implies -r)\n\t-r: recursive\n\t-z: terminate lines with \\0 instead of \\n\n\tOutput is as for git-diff-cache (except there are no unmerged\n\tentries, since they can only exist in the dircache).\n\ngit-diff-tree-helper [-R] [-z] pathname...\n\tReads the output of git-diff-tree and generates diffs (patches)\n\tfor the files listed on the command line.\n\t-R: generate reverse diff\n\t-z: expect input lines to be terminated with \\0\n\ngit-export top-sha1 [base-sha1]\n\ttop-sha1 and base-sha1 are commit-ids\n\tOutputs all the changesets to get to top-sha1, with patches.\n\tIf base-sha1 is given, only outputs changesets from base-sha1\n\tto top-sha1.\n\ngit-fsck-cache [--tags] [--root] [--unreachable] head-sha1...\n\tChecks the consistency of the object repository.\n\tIf given, the head-sha1 parameter(s) is/are the ids of\n\tone or more heads of the commit graph.\n\ngit-http-pull [-c] [-t] [-a] commit-id url\n\t-t: tree\n\t-c: commits\n\t-a: all\n\tFetches the commit object with id commit-id.\n\tWith -t or -a, fetches the tree and blobs for that commit-id.\n\tWith -c or -a, fetches the parents, and recursively fetches\n\teach of their parents, etc.; with -a, fetches the tree and\n\tblobs for each of the ancestors as well.\n\ngit-init-db\n\tmakes .git directory\n\tif SHA1_FILE_DIRECTORY not set, makes .git/objects/xx dirs\n\ngit-ls-files [-c|--cached] [-d|--deleted] [-o|--others] [-i|--ignored]\n\t[-s|--stage] [-u|--unmerged] [-x pattern|--exclude=pattern]\n\t[-X excl-file|--exclude-from=excl-file] [-z]\n\tLists filenames from dircache.\n\t-c|--cached: list files in dircache (default)\n\t-d|--deleted: list files in dircache but not in w.d.\n\t-o|--others: list files in w.d. but not in dircache\n\t-i|--ignored: show files that would be excluded;\n\t\trequires at least one -x|-X|--exclude|--exclude-from\n\t-s|--stage: show full information including merge stage\n\t\tfor each file\n\t-u|--unmerged: only show files with merge stage > 0 in dircache\n\t-x pattern|--exclude=pattern: exclude files matching pattern\n\t-X file|--exclude-from=file: read exclude patterns from\n\t\tfile, one per line\n\t-z: terminate lines with \\0 instead of \\n\n\tWithout -s, just prints pathnames, one per line.\n\tWith -s, prints:\n\t\tmode sha1 stage pathname\n\ngit-ls-tree [-z] [-r] sha1\n\tprints contents of tree object in readable form\n\t4 columns: mode type sha1 name\n\t-z: terminate lines with \\0 instead of \\n\n\t-r: show subdirectories recursively\n\ngit-merge-base commit1-id commit2-id\n\tFinds the nearest common ancestor of commit1 and commit2,\n\tand prints its sha1 id\n\ngit-merge-cache <merge-program> [-a] [--] <filename>*\n\t-a: merge all files listed in dircache\n\tFor each file to be merged, do nothing if it is at stage\n\t0 in the dircache.  Otherwise run:\n\t\tmerge-program stage1-id stage2-id stage3-id \\\n\t\t    pathname stage1-mode stage2-mode stage3-mode\n\tThe stageX-id and stageX-mode are \"\" if that stage isn't\n\tpresent in the dircache for that file.\n\ngit-mktag < signature-file\n\tVerifies the input is a syntactically valid tag,\n\tcreates an object containing the input, and prints\n\tits sha1 id.\n\ngit-read-tree (-m | stage0-sha1) [stage1-sha1] [stage2-sha1] [stage3-sha1]\n\ttree-object(s) -> dircache (uids, gids, inos, times, sizes == 0)\n\t-m: merge, i.e. start in stage 1; requires all objects in\n\t    dircache to be stage 0 initially; requires 1 or 3 trees.\n\t    With 1 tree, merges stat info from existing dircache\n\t    for unchanged files (same name and sha1 as tree).\n\t    With 3 trees, does a trivial 3-way merge.  Files merged\n\t    are made stage 0 and old stat info is used if possible.\n\t    Anything non-trivial is left as stage 1,2,3 entries.\n\t    Result goes into new index file.\n\tWithout -m, existing dircache contents are discarded.\n\tNormally only one sha1 id would be given; more than one can be\n\tgiven but no merging is done.\n\ngit-rev-list commit-id\n\tprints the commit-ids of the ancestors of commit-id,\n\tordered by date.\n\ngit-rev-tree [--edges] [^]commit-id [[^]commit-id]*\n\t--edges: show commits whose reachability differs from one or\n\t  more of its parents (reachability == which subset of the\n\t  commit-ids given on the command line it's reachable from).\n\t^ means don't show commits reachable from this commit-id\n\t  (ignored with --edges)\n\teach line of output is formatted as:\n\t  decimal-date commit-id:flags [parent-commit-id:flags]*\n\tflags is in decimal and is a reachability bitmap, i.e.\n\t0x1 is set if reachable from the first commit-id given,\n\t0x2 if reachable from the second, etc.\n\ngit-rpull [-t] [-c] [-a] commit-id url\n\tFlags are like http-pull.\n\tPulls commits, trees and blobs from another machine over\n\tssh; execs ssh to run rpush on the remote machine.\n\turl can be \"-\" meaning just talk over stdin/stdout\n\tinstead of running ssh.\n\ngit-rpush [-t] [-c] [-a] commit-id url\n\tFlags are like http-pull.\n\tPushes commits, tree and blobs from this machine to another\n\tmachine over ssh; execs ssh to run rpull on the remote machine.\n\turl can be \"-\" meaning just talk over stdin/stdout\n\tinstead of running ssh.\n\ngit-tar-tree sha1-id [basedir]\n\tGenerates a tar-file on stdout for the tree identified by\n\tsha1-id, which can be a commit id or a tree id.\n\tIf basedir is given, basedir/ is prepended to all pathnames.\n\ngit-unpack-file sha1-id\n\tGenerates a temporary file name of the form .merge_file_XXXXXX\n\tand writes the contents of the blob object identified by sha1-id\n\tto it; outputs the generated name to stdout.\n\ngit-update-cache [--add] [--remove] [--] pathname...\n\tUpdate dircache entry for filename(s) from w.d.\n\t--add: add pathnames that are in w.d. but not dircache to\n\t    the dircache (without --add, print a message)\n\t--remove: remove pathnames which are in dircache but not\n\t    w.d. from the dircache (without --remove, print a message)\n\ngit-update-cache --refresh [--ignore-missing]\n\tSets uid, gid, times, size on each entry in dircache from w.d.\n\tComplains if mode or data differs (assumes data matches\n\tif size and date match).\n\tComplains if any file not in w.d. unless --ignore-missing is given.\n\ngit-update-cache --cacheinfo mode sha1 path\n\tAdds an entry to the dircache for path with given mode and sha1.\n\ngit-write-tree\n\tCreates a tree object from the contents of the dircache\n\t(creating tree objects for subdirectories, recursively).\n\tPrints sha1 of top-level tree-object to stdout.\n\tComplains if any files are unmerged (merge stage > 0).\n\nN.B.\nw.d. = working directory (.)\ndircache is in .git/index\nobject files are in $SHA1_FILE_DIRECTORY or .git/objects\n"},{"id":"2293","messageId":"4274EB3D.2060602@dgreaves.com","threadId":"418","inReplyTo":"17012.53862.704670.858276@cargo.ozlabs.ibm.com","subject":"Re: Quick command reference","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-05-01T14:44:13Z","receivedAt":"2005-05-01T14:44:13Z","isPatch":false,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Paul Mackerras wrote:\n\n>As an aid to my understanding of the core git commands, I created this\n>summary of the commands and their options and parameters.  I hope it\n>will be useful to others.  Corrections welcome of course.\n>\n>Paul.\n>  \n>\n\nThanks Paul\n\nShame to see duplicated effort...\n\nI've submitted this document to Linus and the list a few times and\nincluded all the feedback but for some reason it's not gone into any of\nthe trees which means that people like you have to redo it from scratch...\n\nGetting frustrated now...\n\nDavid\n\n-- \n\n\n\nThis file contains reference information for the core git commands.\nIt is actually based on the source from Petr Baudis' tree and may\ntherefore contain a few 'extras' that may or may not make it upstream.\n\nThe README contains much useful definition and clarification info -\nread that first.  And of the commands, I suggest reading\n'update-cache' and 'read-tree' first - I wish I had!\n\nThanks to original email authors and proof readers esp Junio C Hamano\n<junkio@cox.net>\n\nDavid Greaves <david@dgreaves.com>\n24/4/05\n\nIdentifier terminology used:\n\n<object>\n\tIndicates any object sha1 identifier\n\n<blob>\n\tIndicates a blob object sha1 identifier\n\n<tree>\n\tIndicates a tree object sha1 identifier\n\n<commit>\n\tIndicates a commit object sha1 identifier\n\n<tree/commit>\n\tIndicates a tree or commit object sha1 identifier (usually\n\tbecause the command can read the <tree> a <commit> contains).\n\t[Eventually may be replaced with <tree> if <tree> means\n\t<tree/commit> in all commands]\n\n<type>\n\tIndicates that an object type is required.\n\tCurrently one of: blob/tree/commit\n\n<file>\n\tIndicates a filename - often includes leading path\n\n<path>\n\tIndicates the path of a file (is this ever useful?)\n\n\n\n################################################################\ncat-file\n\tcat-file (-t | <type>) <object>\n\nProvide contents or type of objects in the repository. The type is\nrequired if -t is not being used to find the object type.\n\n<object>\n\tThe sha1 identifier of the object.\n\n-t\n\tshow the object type identified by <object>\n\n<type>\n\tOne of: blob/tree/commit\n\nOutput\n\nIf -t is specified, one of:\n        blob/tree/commit\n\nOtherwise the raw (though uncompressed) contents of the <object> will\nbe returned.\n\n\n################################################################\ncheck-files\n\tcheck-files <file>...\n\nCheck that a list of files are up-to-date between the filesystem and\nthe cache. Used to verify a patch target before doing a patch.\n\nFiles that do not exist on the filesystem are considered up-to-date\n(whether or not they are in the cache).\n\nEmits an error message on failure.\npreparing to update existing file <file> not in cache\n\t  <file> exists but is not in the cache\n\npreparing to update file <file> not uptodate in cache\n\t  <file> on disk is not up-to-date with the cache\n\nexits with a status code indicating success if all files are\nup-to-date.\n\nsee also: update-cache\n\n\n################################################################\ncheckout-cache\n\tcheckout-cache [-q] [-a] [-f] [-n] [--prefix=<string>]\n\t\t       [--] <file>...\n\nWill copy all files listed from the cache to the working directory\n(not overwriting existing files). Note that the file contents are\nrestored - NOT the file permissions.\n??? l 58 checkout-cache.c says restore executable bit.\n\n-q\n\tbe quiet if files exist or are not in the cache\n\n-f\n\tforces overwrite of existing files\n\n-a\n\tchecks out all files in the cache (will then continue to\n\tprocess listed files).\n-n\n\tDon't checkout new files, only refresh files already checked\n\tout.\n\n--prefix=<string>\n\tWhen creating files, prepend <string> (usually a directory\n\tincluding a trailing /)\n\n--\n\tDo not interpret any more arguments as options.\n\nNote that the order of the flags matters:\n\n\tcheckout-cache -a -f file.c\n\nwill first check out all files listed in the cache (but not overwrite\nany old ones), and then force-checkout file.c a second time (ie that\none _will_ overwrite any old contents with the same filename).\n\nAlso, just doing \"checkout-cache\" does nothing. You probably meant\n\"checkout-cache -a\". And if you want to force it, you want\n\"checkout-cache -f -a\".\n\nIntuitiveness is not the goal here. Repeatability is. The reason for\nthe \"no arguments means no work\" thing is that from scripts you are\nsupposed to be able to do things like\n\n\tfind . -name '*.h' -print0 | xargs -0 checkout-cache -f --\n\nwhich will force all existing *.h files to be replaced with their\ncached copies. If an empty command line implied \"all\", then this would\nforce-refresh everything in the cache, which was not the point.\n\nTo update and refresh only the files already checked out:\n\n   checkout-cache -n -f -a && update-cache --ignore-missing --refresh\n\nOh, and the \"--\" is just a good idea when you know the rest will be\nfilenames. Just so that you wouldn't have a filename of \"-a\" causing\nproblems (not possible in the above example, but get used to it in\nscripting!).\n\nThe prefix ability basically makes it trivial to use checkout-cache as\na \"export as tree\" function. Just read the desired tree into the\nindex, and do a\n  \n        checkout-cache --prefix=export-dir/ -a\n  \nand checkout-cache will \"export\" the cache into the specified\ndirectory.\n  \nNOTE! The final \"/\" is important. The exported name is literally just\nprefixed with the specified string, so you can also do something like\n  \n        checkout-cache --prefix=.merged- Makefile\n  \nto check out the currently cached copy of \"Makefile\" into the file\n\".merged-Makefile\".\n\n\n################################################################\ncommit-tree\n\tcommit-tree <tree> [-p <parent commit>]*   < changelog\n\nCreates a new commit object based on the provided tree object and\nemits the new commit object id on stdout. If no parent is given then\nit is considered to be an initial tree.\n\nA commit object usually has 1 parent (a commit after a change) or up\nto 16 parents.  More than one parent represents a merge of branches\nthat led to them.\n\nWhile a tree represents a particular directory state of a working\ndirectory, a commit represents that state in \"time\", and explains how\nto get there.\n\nNormally a commit would identify a new \"HEAD\" state, and while git\ndoesn't care where you save the note about that state, in practice we\ntend to just write the result to the file \".git/HEAD\", so that we can\nalways see what the last committed state was.\n\nOptions\n\n<tree>\n\tAn existing tree object\n\n-p <parent commit>\n\tEach -p indicates a the id of a parent commit object.\n\t\n\nCommit Information\n\nA commit encapsulates:\n\tall parent object ids\n\tauthor name, email and date\n\tcommitter name and email and the commit time.\n\nIf not provided, commit-tree uses your name, hostname and domain to\nprovide author and committer info. This can be overridden using the\nfollowing environment variables.\n\tAUTHOR_NAME\n\tAUTHOR_EMAIL\n\tAUTHOR_DATE\n\tCOMMIT_AUTHOR_NAME\n\tCOMMIT_AUTHOR_EMAIL\n(nb <,> and '\\n's are stripped)\n\nA commit comment is read from stdin (max 999 chars). If a changelog\nentry is not provided via '<' redirection, commit-tree will just wait\nfor one to be entered and terminated with ^D\n\nsee also: write-tree\n\n\n################################################################\ndiff-cache\n\tdiff-cache [-p] [-r] [-z] [--cached] <tree/commit>\n\nCompares the content and mode of the blobs found via a tree object\nwith the content of the current cache and, optionally ignoring the\nstat state of the file on disk.\n\n<tree/commit>\n\tThe id of a tree or commit object to diff against.\n\n-p\n\tgenerate patch (see section on generating patches)\n\n-r\n\trecurse\n\n-z\n\t\\0 line termination on output\n\n--cached\n\tdo not consider the on-disk file at all\n\nOutput format:\n\nSee \"Output format from diff-cache, diff-tree and show-diff\" section.\n\nOperating Modes\n\nYou can choose whether you want to trust the index file entirely\n(using the \"--cached\" flag) or ask the diff logic to show any files\nthat don't match the stat state as being \"tentatively changed\".  Both\nof these operations are very useful indeed.\n\nCached Mode\n\nIf --cached is specified, it allows you to ask:\n\tshow me the differences between HEAD and the current index\n\tcontents (the ones I'd write with a \"write-tree\")\n\nFor example, let's say that you have worked on your index file, and are\nready to commit. You want to see eactly _what_ you are going to commit is\nwithout having to write a new tree object and compare it that way, and to\ndo that, you just do\n\n\tdiff-cache --cached $(cat .git/HEAD)\n\nExample: let's say I had renamed \"commit.c\" to \"git-commit.c\", and I had \ndone an \"upate-cache\" to make that effective in the index file. \n\"show-diff\" wouldn't show anything at all, since the index file matches \nmy working directory. But doing a diff-cache does:\n\ttorvalds@ppc970:~/git> diff-cache --cached $(cat .git/HEAD)\n\t-100644 blob    4161aecc6700a2eb579e842af0b7f22b98443f74        commit.c\n\t+100644 blob    4161aecc6700a2eb579e842af0b7f22b98443f74        git-commit.c\n\nAnd as you can see, the output matches \"diff-tree -r\" output (we\nalways do equivalent of \"-r\", since the index is flat).\nYou can trivially see that the above is a rename.\n\nIn fact, \"diff-cache --cached\" _should_ always be entirely equivalent to\nactually doing a \"write-tree\" and comparing that. Except this one is much\nnicer for the case where you just want to check where you are.\n\nSo doing a \"diff-cache --cached\" is basically very useful when you are \nasking yourself \"what have I already marked for being committed, and \nwhat's the difference to a previous tree\".\n\nNon-cached Mode\n\nThe \"non-cached\" mode takes a different approach, and is potentially\nthe even more useful of the two in that what it does can't be emulated\nwith a \"write-tree + diff-tree\". Thus that's the default mode.  The\nnon-cached version asks the question\n\n   \"show me the differences between HEAD and the currently checked out \n    tree - index contents _and_ files that aren't up-to-date\"\n\nwhich is obviously a very useful question too, since that tells you what\nyou _could_ commit. Again, the output matches the \"diff-tree -r\" output to\na tee, but with a twist.\n\nThe twist is that if some file doesn't match the cache, we don't have a\nbacking store thing for it, and we use the magic \"all-zero\" sha1 to show\nthat. So let's say that you have edited \"kernel/sched.c\", but have not\nactually done an update-cache on it yet - there is no \"object\" associated\nwith the new state, and you get:\n\n\ttorvalds@ppc970:~/v2.6/linux> diff-cache $(cat .git/HEAD )\n\t*100644->100664 blob    7476bbcfe5ef5a1dd87d745f298b831143e4d77e->0000000000000000000000000000000000000000      kernel/sched.c\n\nie it shows that the tree has changed, and that \"kernel/sched.c\" has is\nnot up-to-date and may contain new stuff. The all-zero sha1 means that to\nget the real diff, you need to look at the object in the working directory\ndirectly rather than do an object-to-object diff.\n\nNOTE! As with other commands of this type, \"diff-cache\" does not actually \nlook at the contents of the file at all. So maybe \"kernel/sched.c\" hasn't \nactually changed, and it's just that you touched it. In either case, it's \na note that you need to upate-cache it to make the cache be in sync.\n\nNOTE 2! You can have a mixture of files show up as \"has been updated\" and\n\"is still dirty in the working directory\" together. You can always tell\nwhich file is in which state, since the \"has been updated\" ones show a\nvalid sha1, and the \"not in sync with the index\" ones will always have the\nspecial all-zero sha1.\n\n################################################################\ndiff-tree\n\tdiff-tree [-p] [-r] [-z] <tree/commit> <tree/commit> [<pattern>]*\n\nCompares the content and mode of the blobs found via two tree objects.\n\nNote that diff-tree can use the tree encapsulated in a commit object.\n\n<tree sha1>\n\tThe id of a tree or commit object.\n\n<pattern>\n\n\tIf provided, the results are limited to a subset of files\n\tmatching one of these prefix strings.\n\tie file matches /^<pattern1>|<pattern2>|.../\n\tNote that pattern does not provide any wildcard or regexp features.\n\n-p\n\tgenerate patch (see section on generating patches)\n\n-r\n\trecurse\n\n-z\n\t\\0 line termination on output\n\nLimiting Output\n\nIf you're only interested in differences in a subset of files, for\nexample some architecture-specific files, you might do:\n\n\tdiff-tree -r <tree/commit> <tree/commit> arch/ia64 include/asm-ia64\n\nand it will only show you what changed in those two directories.\n\nOr if you are searching for what changed in just kernel/sched.c, just do\n\n\tdiff-tree -r <tree/commit> <tree/commit> kernel/sched.c\n\nand it will ignore all differences to other files.\n\nThe pattern is always the prefix, and is matched exactly (ie there are no\nwildcards - although matching a directory, which it does support, can\nobviously be seen as a \"wildcard\" for all the files under that directory).\n\nOutput format:\n\nSee \"Output format from diff-cache, diff-tree and show-diff\" section.\n\nAn example of normal usage is:\n\n\ttorvalds@ppc970:~/git> diff-tree 5319e4d609cdd282069cc4dce33c1db559539b03 b4e628ea30d5ab3606119d2ea5caeab141d38df7\n\t*100664->100664 blob    ac348b7d5278e9d04e3a1cd417389379c32b014f->a01513ed4d4d565911a60981bfb4173311ba3688      fsck-cache.c\n\nwhich tells you that the last commit changed just one file (it's from\nthis one:\n\n\tcommit 3c6f7ca19ad4043e9e72fa94106f352897e651a8\n\ttree 5319e4d609cdd282069cc4dce33c1db559539b03\n\tparent b4e628ea30d5ab3606119d2ea5caeab141d38df7\n\tauthor Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005\n\tcommitter Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005\n\n\tMake \"fsck-cache\" print out all the root commits it finds.\n\n\tOnce I do the reference tracking, I'll also make it print out all the\n\tHEAD commits it finds, which is even more interesting.\n\nin case you care).\n\n################################################################\ndiff-tree-helper\n\tdiff-tree-helper [-z]\n\nReads output from diff-cache, diff-tree and show-diff and\ngenerates patch format output.\n\n-z\n\t\\0 line termination on input\n\nSee also the section on generating patches.\n\n################################################################\nfsck-cache\n\tfsck-cache [[--unreachable] <commit>*]\n\nVerifies the connectivity and validity of the objects in the database.\n\n<commit>\n\tA commit object to treat as the head of an unreachability\n\ttrace\n\n--unreachable\n\tprint out objects that exist but that aren't readable from any\n\tof the specified root nodes\n\nIt tests SHA1 and general object sanity, but it does full tracking of\nthe resulting reachability and everything else. It prints out any\ncorruption it finds (missing or bad objects), and if you use the\n\"--unreachable\" flag it will also print out objects that exist but\nthat aren't readable from any of the specified root nodes.\n\nSo for example\n\n\tfsck-cache --unreachable $(cat .git/HEAD)\n\nor, for Cogito users:\n\n\tfsck-cache --unreachable $(cat .git/heads/*)\n\nwill do quite a _lot_ of verification on the tree. There are a few\nextra validity tests to be added (make sure that tree objects are\nsorted properly etc), but on the whole if \"fsck-cache\" is happy, you\ndo have a valid tree.\n\nAny corrupt objects you will have to find in backups or other archives\n(ie you can just remove them and do an \"rsync\" with some other site in\nthe hopes that somebody else has the object you have corrupted).\n\nOf course, \"valid tree\" doesn't mean that it wasn't generated by some\nevil person, and the end result might be crap. Git is a revision\ntracking system, not a quality assurance system ;)\n\nExtracted Diagnostics\n\nexpect dangling commits - potential heads - due to lack of head information\n\tYou haven't specified any nodes as heads so it won't be\n\tpossible to differentiate between un-parented commits and\n\troot nodes.\n\nmissing sha1 directory '<dir>'\n\tThe directory holding the sha1 objects is missing.\n\nunreachable <type> <object>\n\tThe <type> object <object>, isn't actually referred to directly\n\tor indirectly in any of the trees or commits seen. This can\n\tmean that there's another root na SHA1_ode that you're not specifying\n\tor that the tree is corrupt. If you haven't missed a root node\n\tthen you might as well delete unreachable nodes since they\n\tcan't be used.\n\nmissing <type> <object>\n\tThe <type> object <object>, is referred to but isn't present in\n\tthe database.\n\ndangling <type> <object>\n\tThe <type> object <object>, is present in the database but never\n\t_directly_ used. A dangling commit could be a root node.\n\nwarning: fsck-cache: tree <tree> has full pathnames in it\n\tAnd it shouldn't...\n\nsha1 mismatch <object>\n\tThe database has an object who's sha1 doesn't match the\n\tdatabase value.\n\tThis indicates a ??serious?? data integrity problem.\n\t(note: this error occured during early git development when\n\tthe database format changed.)\n\nEnvironment Variables\n\nSHA1_FILE_DIRECTORY\n\tused to specify the object database root (usually .git/objects)\n\n################################################################\ngit-export\n\tgit-export top [base]\n\nprobably deprecated:\nOn Wed, 20 Apr 2005, Petr Baudis wrote:\n>> I will probably not buy git-export, though. (That is, it is merged, but\n>> I won't make git frontend for it.) My \"git export\" already does\n>> something different, but more importantly, \"git patch\" of mine already\n>> does effectively the same thing as you do, just for a single patch; so I\n>> will probably just extend it to do it for an (a,b] range of patches.\n\n\nThat's fine. It was a quick hack, just to show that if somebody wants to, \nthe data is trivially exportable.\n\n\t\tLinus\n\nAlthough in Linus' distribution, git-export is not part of 'core' git.\n\n################################################################\ninit-db\n\tinit-db\n\nThis simply creates an empty git object database - basically a .git\ndirectory.\n\nIf the object storage directory is specified via the\nSHA1_FILE_DIRECTORY environment variable then the sha1 directories are\ncreated underneath - otherwise the default .git/objects directory is\nused.\n\ninit-db won't hurt an existing repository.\n\n\n################################################################\nls-tree\n\tls-tree [-r] [-z] <tree/commit>\n\nconvert the tree object to a human readable (and script\nprocessable) form.\n\n<tree/commit>\n\tId of a tree or commit object.\n-r\n\trecurse into sub-trees\n\n-z\n\t\\0 line termination on output\n\nOutput Format\n<mode>\\t\t<type>\\t\t<object>\\t\t<path><file>\t\n\n\n################################################################\nmerge-base\n\tmerge-base <commit> <commit>\n\nmerge-base finds as good a common ancestor as possible. Given a\nselection of equally good common ancestors it should not be relied on\nto decide in any particular way.\n\nThe merge-base algorithm is still in flux - use the source...\n\n\n################################################################\nmerge-cache\n\tmerge-cache <merge-program> (-a | -- | <file>*) \n\nThis looks up the <file>(s) in the cache and, if there are any merge\nentries, unpacks all of them (which may be just one file, of course)\ninto up to three separate temporary files, and then executes the\nsupplied <merge-program> with those three files as arguments 1,2,3\n(empty argument if no file), and <file> as argument 4.\n\n--\n\tInterpret all future arguments as filenames\n\n-a\n\tRun merge against all files in the cache that need merging.\n\nIf merge-cache is called with multiple <file>s (or -a) then it\nprocesses them in turn only stopping if merge returns a non-zero exit\ncode.\n\nTypically this is run with the a script calling the merge command from\nthe RCS package.\n\nA sample script called git-merge-one-file-script is included in the\nditribution.\n\nALERT ALERT ALERT! The git \"merge object order\" is different from the\nRCS \"merge\" program merge object order. In the above ordering, the\noriginal is first. But the argument order to the 3-way merge program\n\"merge\" is to have the original in the middle. Don't ask me why.\n\nExamples:\n\n\ttorvalds@ppc970:~/merge-test> merge-cache cat MM\n\tThis is MM from the original tree.\t\t\t# original\n\tThis is modified MM in the branch A.\t\t\t# merge1\n\tThis is modified MM in the branch B.\t\t\t# merge2\n\tThis is modified MM in the branch B.\t\t\t# current contents\n\nor \n\n\ttorvalds@ppc970:~/merge-test> merge-cache cat AA MM\n\tcat: : No such file or directory\n\tThis is added AA in the branch A.\n\tThis is added AA in the branch B.\n\tThis is added AA in the branch B.\n\tfatal: merge program failed\n\nwhere the latter example shows how \"merge-cache\" will stop trying to\nmerge once anything has returned an error (ie \"cat\" returned an error\nfor the AA file, because it didn't exist in the original, and thus\n\"merge-cache\" didn't even try to merge the MM thing).\n\n\n################################################################\nread-tree\n\tread-tree (<tree/commit> | -m <tree/commit1> [<tree/commit2> <tree/commit3>])\"\n\nReads the tree information given by <tree> into the directory cache,\nbut does not actually _update_ any of the files it \"caches\". (see:\ncheckout-cache)\n\nOptionally, it can merge a tree into the cache or perform a 3-way\nmerge.\n\nTrivial merges are done by read-tree itself.  Only conflicting paths\nwill be in unmerged state when read-tree returns.\n\n-m\n\tPerform a merge, not just a read\n\n<tree#>\n\tThe id of the tree object(s) to be read/merged.\n\n\nMerging\nIf -m is specified, read-tree performs 2 kinds of merge, a single tree\nmerge if only 1 tree is given or a 3-way merge if 3 trees are\nprovided.\n\nSingle Tree Merge\nIf only 1 tree is specified, read-tree operates as if the user did not\nspecify \"-m\", except that if the original cache has an entry for a\ngiven pathname; and the contents of the path matches with the tree\nbeing read, the stat info from the cache is used. (In other words, the\ncache's stat()s take precedence over the merged tree's)\n\nThat means that if you do a \"read-tree -m <newtree>\" followed by a\n\"checkout-cache -f -a\", the checkout-cache only checks out the stuff\nthat really changed.\n\nThis is used to avoid unnecessary false hits when show-diff is\nrun after read-tree.\n\n3-Way Merge\nEach \"index\" entry has two bits worth of \"stage\" state. stage 0 is the\nnormal one, and is the only one you'd see in any kind of normal use.\n\nHowever, when you do \"read-tree\" with multiple trees, the \"stage\"\nstarts out at 0, but increments for each tree you read. And in\nparticular, the \"-m\" flag means \"start at stage 1\" instead.\n\nThis means that you can do\n\n\tread-tree -m <tree1> <tree2> <tree3>\n\nand you will end up with an index with all of the <tree1> entries in\n\"stage1\", all of the <tree2> entries in \"stage2\" and all of the\n<tree3> entries in \"stage3\".\n\nFurthermore, \"read-tree\" has special-case logic that says: if you see\na file that matches in all respects in the following states, it\n\"collapses\" back to \"stage0\":\n\n   - stage 2 and 3 are the same; take one or the other (it makes no\n     difference - the same work has been done on stage 2 and 3)\n\n   - stage 1 and stage 2 are the same and stage 3 is different; take\n     stage 3 (some work has been done on stage 3)\n\n   - stage 1 and stage 3 are the same and stage 2 is different take\n     stage 2 (some work has been done on stage 2)\n\nWrite-tree refuses to write a nonsensical tree, so write-tree will\ncomplain about unmerged entries if it sees a single entry that is not\nstage 0\".\n\nOk, this all sounds like a collection of totally nonsensical rules,\nbut it's actually exactly what you want in order to do a fast\nmerge. The different stages represent the \"result tree\" (stage 0, aka\n\"merged\"), the original tree (stage 1, aka \"orig\"), and the two trees\nyou are trying to merge (stage 2 and 3 respectively).\n\nIn fact, the way \"read-tree\" works, it's entirely agnostic about how\nyou assign the stages, and you could really assign them any which way,\nand the above is just a suggested way to do it (except since\n\"write-tree\" refuses to write anything but stage0 entries, it makes\nsense to always consider stage 0 to be the \"full merge\" state).\n\nSo what happens? Try it out. Select the original tree, and two trees\nto merge, and look how it works:\n\n - if a file exists in identical format in all three trees, it will \n   automatically collapse to \"merged\" state by the new read-tree.\n\n - a file that has _any_ difference what-so-ever in the three trees\n   will stay as separate entries in the index. It's up to \"script\n   policy\" to determine how to remove the non-0 stages, and insert a\n   merged version.  But since the index is always sorted, they're easy\n   to find: they'll be clustered together.\n\n - the index file saves and restores with all this information, so you\n   can merge things incrementally, but as long as it has entries in\n   stages 1/2/3 (ie \"unmerged entries\") you can't write the result.\n\nSo now the merge algorithm ends up being really simple:\n\n - you walk the index in order, and ignore all entries of stage 0,\n   since they've already been done.\n\n - if you find a \"stage1\", but no matching \"stage2\" or \"stage3\", you\n   know it's been removed from both trees (it only existed in the\n   original tree), and you remove that entry.  - if you find a\n   matching \"stage2\" and \"stage3\" tree, you remove one of them, and\n   turn the other into a \"stage0\" entry. Remove any matching \"stage1\"\n   entry if it exists too.  .. all the normal trivial rules ..\n\nIncidentally - it also means that you don't even have to have a separate \nsubdirectory for this. All the information literally is in the index file, \nwhich is a temporary thing anyway. There is no need to worry about what is in \nthe working directory, since it is never shown and never used.\n\nsee also:\nwrite-tree\nshow-files\n\n\n################################################################\nrev-list <commit>\n\nLists commit objects in reverse chronological order starting at the\ngiven commit, taking ancestry relationship into account.  This is\nuseful to produce human-readable log output.\n\n\n################################################################\nrev-tree\n\trev-tree [--edges] [--cache <cache-file>] [^]<commit> [[^]<commit>]\n\nProvides the revision tree for one or more commits.\n\n--edges\n\tShow edges (ie places where the marking changes between parent\n\tand child)\n\n--cache <cache-file>\n\tUse the specified file as a cache. [Not implemented yet]\n\n[^]<commit>\n\tThe commit id to trace (a leading caret means to ignore this\n\tcommit-id and below)\n\nOutput:\n<date> <commit>:<flags> [<parent-commit>:<flags> ]*\n\n<date>\n\tDate in 'seconds since epoch'\n\n<commit>\n\tid of commit object\n\n<parent-commit>\n\tid of each parent commit object (>1 indicates a merge)\n\n<flags>\n\n\tThe flags are read as a bitmask representing each commit\n\tprovided on the commandline. eg: given the command:\n\n\t\t $ rev-tree <com1> <com2> <com3>\n\n\tThe output:\n\n\t    <date> <commit>:5\n\n\t means that <commit> is reachable from <com1>(1) and <com3>(4)\n\t\nA revtree can get quite large. rev-tree will eventually allow you to\ncache previous state so that you don't have to follow the whole thing\ndown.\n\nSo the change difference between two commits is literally\n\n\trev-tree [commit-id1]  > commit1-revtree\n\trev-tree [commit-id2]  > commit2-revtree\n\tjoin -t : commit1-revtree commit2-revtree > common-revisions\n\n(this is also how to find the most common parent - you'd look at just\nthe head revisions - the ones that aren't referred to by other\nrevisions - in \"common-revision\", and figure out the best one. I\nthink.)\n\n\n################################################################\nshow-diff\n\tshow-diff [-p] [-q] [-s] [-z] [paths...]\n\nCompares the files in the working tree and the cache.  When paths\nare specified, compares only those named paths.  Otherwise all\nentries in the cache are compared.  The output format is the\nsame as diff-cache and diff-tree.\n\n-p\n\tgenerate patch (see section on generating patches)\n\n-q\n\tRemain silent even on nonexisting files\n\n-s\n\tDoes not do anything other than what -q does.\n\nOutput format:\n\nSee \"Output format from diff-cache, diff-tree and show-diff\" section.\n\n################################################################\nshow-files\n\tshow-files [-z] [-t]\n\t\t(--[cached|deleted|others|ignored|stage|unmerged])*\n\t\t(-[c|d|o|i|s|u])*\n\t\t[-x <pattern>|--exclude=<pattern>]\n\t\t[-X <file>|--exclude-from=<file>]\n\nThis merges the file listing in the directory cache index with the\nactual working directory list, and shows different combinations of the\ntwo.\n\nOne or more of the options below may be used to determine the files\nshown:\n\n-c|--cached\n\tShow cached files in the output (default)\n\n-d|--deleted\n\tShow deleted files in the output\n\n-o|--others\n\tShow other files in the output\n\n-i|--ignored\n\tShow ignored files in the output\n\tNote the this also reverses any exclude list present.\n\n-s|--stage\n\tShow stage files in the output\n\n-u|--unmerged\n\tShow unmerged files in the output (forces --stage)\n\n#-t [not in Linus' tree (yet?)]\n#\tIdentify the file status with the following tags (followed by\n#\ta space) at the start of each line:\n#\tH\tcached\n#\tM\tunmerged\n#\tR\tremoved/deleted\n#\t?\tother\n\n-z\n\t\\0 line termination on output\n\n-x|--exclude=<pattern>\n\tSkips files matching pattern.\n\tNote that pattern is a shell wildcard pattern.\n\n-X|--exclude-from=<file>\n\texclude patterns are read from <file>; 1 per line.\n\tAllows the use of the famous dontdiff file as follows to find\n\tout about uncommitted files just as dontdiff is used with\n\tthe diff command:\n\t     show-files --others --exclude-from=dontdiff\n\nOutput\nshow files just outputs the filename unless --stage is specified in\nwhich case it outputs:\n\n[<tag> ]<mode> <object> <stage> <file>\n\nshow-files --unmerged\" and \"show-files --stage \" can be used to examine\ndetailed information on unmerged paths.\n\nFor an unmerged path, instead of recording a single mode/SHA1 pair,\nthe dircache records up to three such pairs; one from tree O in stage\n1, A in stage 2, and B in stage 3.  This information can be used by\nthe user (or Cogito) to see what should eventually be recorded at the\npath. (see read-cache for more information on state)\n\nsee also:\nread-cache\n\n\n################################################################\nunpack-file\n\tunpack-file <blob>\n\nCreates a file holding the contents of the blob specified by sha1. It\nreturns the name of the temporary file in the following format:\n\t.merge_file_XXXXX\n\n<blob>\n\tMust be a blob id\n\n################################################################\nupdate-cache\n\tupdate-cache [--add] [--remove] [--refresh [--ignore-missing]]\n\t\t     [--cacheinfo <mode> <object> <path>]*\n\t\t     [--] [<file>]*\n\nModifies the index or directory cache. Each file mentioned is updated\ninto the cache and any 'unmerged' or 'needs updating' state is\ncleared.\n\nThe way update-cache handles files it is told about can be modified\nusing the various options:\n\n--add\n\tIf a specified file isn't in the cache already then it's\n\tadded.\n\tDefault behaviour is to ignore new files.\n\n--remove\n\tIf a specified file is in the cache but is missing then it's\n\tremoved.\n\tDefault behaviour is to ignore removed file.\n\n--refresh\n\tLooks at the current cache and checks to see if merges or\n\tupdates are needed by checking stat() information.\n\n--ignore-missing\n\tIgnores missing files during a --refresh\n\n--cacheinfo <mode> <object> <path>\n\tDirectly insert the specified info into the cache.\n\t\n--\n\tDo not interpret any more arguments as options.\n\n<file>\n\tFiles to act on.\n\tNote that files begining with '.' are discarded. This includes\n\t\"./file\" and \"dir/./file\". If you don't want this, then use\t\n\tcleaner names.\n\tThe same applies to directories ending '/' and paths with '//'\n\n\nUsing --refresh\n\n--refresh does not calculate a new sha1 file or bring the cache\nup-to-date for mode/content changes. But what it _does_ do is to\n\"re-match\" the stat information of a file with the cache, so that you\ncan refresh the cache for a file that hasn't been changed but where\nthe stat entry is out of date.\n\nFor example, you'd want to do this after doing a \"read-tree\", to link\nup the stat cache details with the proper files.\n\nUsing --cacheinfo\n--cacheinfo is used to register a file that is not in the current\nworking directory.  This is useful for minimum-checkout merging.\n\nTo pretend you have a file with mode and sha1 at path, say:\n\n $ update-cache --cacheinfo mode sha1 path\n\nTo update and refresh only the files already checked out:\n\n   checkout-cache -n -f -a && update-cache --ignore-missing --refresh\n\n\n################################################################\nwrite-tree\n\twrite-tree\n\nCreates a tree object using the current cache.\n\nThe cache must be merged.\n\nConceptually, write-tree sync()s the current directory cache contents\ninto a set of tree files.\nIn order to have that match what is actually in your directory right\nnow, you need to have done a \"update-cache\" phase before you did the\n\"write-tree\".\n\n\n################################################################\n\nOutput format from diff-cache, diff-tree and show-diff.\n\nThese commands all compare two sets of things; what are\ncompared are different:\n\n    diff-cache <tree/commit>\n\n        compares the <tree/commit> and the files on the filesystem.\n\n    diff-cache --cached <tree/commit>\n\n        compares the <tree/commit> and the cache.\n\n    diff-tree [-r] <tree/commit-1> <tree/commit-2> [paths...]\n\n        compares the trees named by the two arguments.\n\n    show-diff [paths...]\n\n        compares the cache and the files on the filesystem.\n\nThe following desription uses \"old\" and \"new\" to mean those\ncompared entities.\n\nFor files in old but not in new (i.e. removed):\n-<mode> \\t <type> \\t <object> \\t <path>\n\nFor files not in old but in new (i.e. added):\n+<mode> \\t <type> \\t <object> \\t <path>\n\nFor files that differ:\n*<old-mode>-><new-mode> \\t <type> \\t <old-sha1>-><new-sha1> \\t <path>\n\n<new-sha1> is shown as all 0's if new is a file on the\nfilesystem and it is out of sync with the cache.  Example:\n\n    *100644->100660 blob    5be4a414b32cf4204f889469942986d3d783da84->0000000000000000000000000000000000000000      file.c\n\n################################################################\n\nGenerating patches\n\nWhen diff-cache, diff-tree, or show-diff are run with a -p\noption, they do not produce the output described in \"Output\nformat from diff-cache, diff-tree and show-diff\" section.  It\ninstead produces a patch file.\n\nThe patch generation can be customized at two levels.  This\ncustomization also applies to diff-tree-helper.\n\n1. When the environment variable GIT_EXTERNAL_DIFF is not set,\n   these commands internally invoke diff like this:\n\n   diff -L k/<path> -L l/<path> -pu <old> <new>\n\n   For added files, /dev/null is used for <old>.  For removed\n   files, /dev/null is used for <new>\n\n   The first part of the above command-line can be customized via\n   the environment variable GIT_DIFF_CMD.  For example, if you\n   do not want to show the extra level of leading path, you can\n   say this:\n\n   GIT_DIFF_CMD=\"diff -L'%s' -L'%s'\" show-diff -p\n\n   Caution:  Do not use more than two '%s' in GIT_DIFF_CMD.\n\n   The diff formatting options can be customized via the\n   environment variable GIT_DIFF_OPTS.  For example, if you\n   prefer context diff:\n\n   GIT_DIFF_OPTS=-c diff-cache -p $(cat .git/HEAD)\n\n\n2. When the environment variable GIT_EXTERNAL_DIFF is set, the\n   program named by it is called, instead of the diff invocation\n   described above.\n\n   For a path that is added, removed, or modified,\n   GIT_EXTERNAL_DIFF is called with 7 parameters:\n\n     path old-file old-hex old-mode new-file new-hex new-mode\n\n   where\n     <old|new>-file are files GIT_EXTERNAL_DIFF can use to read the\n                    contents of <old|ne>,\n     <old|new>-hex are the 40-hexdigit SHA1 hashes,\n     <old|new>-mode are the octal representation of the file modes.\n\n   The file parameters can point at the user's working file\n   (e.g. new-file in show-diff), /dev/null (e.g. old-file when a\n   new file is added), or a temporary file (e.g. old-file in the\n   cache).  GIT_EXTERNAL_DIFF should not worry about\n   unlinking the temporary file --- it is removed when\n   GIT_EXTERNAL_DIFF exits.\n\n   For a path that is unmerged, GIT_EXTERNAL_DIFF is called with\n   1 parameter, path.\n\n################################################################\n\nTerminology: - see README for description\nEach line contains terms used interchangeably\n\nobject database, .git directory\ndirectory cache, index\nid, sha1, sha1-id, sha1 hash\ntype, tag\nblob, blob object\ntree, tree object\ncommit, commit object\nparent\nroot object\nchangeset\n\n\ngit Environment Variables\nAUTHOR_NAME\nAUTHOR_EMAIL\nAUTHOR_DATE\nCOMMIT_AUTHOR_NAME\nCOMMIT_AUTHOR_EMAIL\nGIT_DIFF_CMD\nGIT_DIFF_OPTS\nGIT_EXTERNAL_DIFF\nGIT_INDEX_FILE\nSHA1_FILE_DIRECTORY\n\n"},{"id":"2294","messageId":"4274F373.6030001@khandalf.com","threadId":"418","inReplyTo":"4274EB3D.2060602@dgreaves.com","subject":"Re: Quick command reference","fromName":"Brian O'Mahoney","fromEmail":"omb@khandalf.com","sentAt":"2005-05-01T15:19:15Z","receivedAt":"2005-05-01T15:19:15Z","isPatch":false,"sender":{"key":"omb@khandalf.com","avatar":null},"body":"Thank you both for taking the time and trouble to do this, particularly\nwith the name changes and new options; why don't you merge your efforts\nand produce a GIT-Mini-HOWTO BTW send it off as a patch again!\n\nregards, Brian\n\nDavid Greaves wrote:\n> Paul Mackerras wrote:\n> \n> \n>>As an aid to my understanding of the core git commands, I created this\n>>summary of the commands and their options and parameters.  I hope it\n>>will be useful to others.  Corrections welcome of course.\n>>\n>>Paul.\n>> \n>>\n> \n> \n> Thanks Paul\n> \n> Shame to see duplicated effort...\n> \n> I've submitted this document to Linus and the list a few times and\n> included all the feedback but for some reason it's not gone into any of\n> the trees which means that people like you have to redo it from scratch...\n> \n> Getting frustrated now...\n> \n> David\n> \n> \n> \n> ------------------------------------------------------------------------\n> \n> This file contains reference information for the core git commands.\n> It is actually based on the source from Petr Baudis' tree and may\n> therefore contain a few 'extras' that may or may not make it upstream.\n> \n> The README contains much useful definition and clarification info -\n> read that first.  And of the commands, I suggest reading\n> 'update-cache' and 'read-tree' first - I wish I had!\n> \n> Thanks to original email authors and proof readers esp Junio C Hamano\n> <junkio@cox.net>\n> \n> David Greaves <david@dgreaves.com>\n> 24/4/05\n> \n> Identifier terminology used:\n> \n> <object>\n> \tIndicates any object sha1 identifier\n> \n> <blob>\n> \tIndicates a blob object sha1 identifier\n> \n> <tree>\n> \tIndicates a tree object sha1 identifier\n> \n> <commit>\n> \tIndicates a commit object sha1 identifier\n> \n> <tree/commit>\n> \tIndicates a tree or commit object sha1 identifier (usually\n> \tbecause the command can read the <tree> a <commit> contains).\n> \t[Eventually may be replaced with <tree> if <tree> means\n> \t<tree/commit> in all commands]\n> \n> <type>\n> \tIndicates that an object type is required.\n> \tCurrently one of: blob/tree/commit\n> \n> <file>\n> \tIndicates a filename - often includes leading path\n> \n> <path>\n> \tIndicates the path of a file (is this ever useful?)\n> \n> \n> \n> ################################################################\n> cat-file\n> \tcat-file (-t | <type>) <object>\n> \n> Provide contents or type of objects in the repository. The type is\n> required if -t is not being used to find the object type.\n> \n> <object>\n> \tThe sha1 identifier of the object.\n> \n> -t\n> \tshow the object type identified by <object>\n> \n> <type>\n> \tOne of: blob/tree/commit\n> \n> Output\n> \n> If -t is specified, one of:\n>         blob/tree/commit\n> \n> Otherwise the raw (though uncompressed) contents of the <object> will\n> be returned.\n> \n> \n> ################################################################\n> check-files\n> \tcheck-files <file>...\n> \n> Check that a list of files are up-to-date between the filesystem and\n> the cache. Used to verify a patch target before doing a patch.\n> \n> Files that do not exist on the filesystem are considered up-to-date\n> (whether or not they are in the cache).\n> \n> Emits an error message on failure.\n> preparing to update existing file <file> not in cache\n> \t  <file> exists but is not in the cache\n> \n> preparing to update file <file> not uptodate in cache\n> \t  <file> on disk is not up-to-date with the cache\n> \n> exits with a status code indicating success if all files are\n> up-to-date.\n> \n> see also: update-cache\n> \n> \n> ################################################################\n> checkout-cache\n> \tcheckout-cache [-q] [-a] [-f] [-n] [--prefix=<string>]\n> \t\t       [--] <file>...\n> \n> Will copy all files listed from the cache to the working directory\n> (not overwriting existing files). Note that the file contents are\n> restored - NOT the file permissions.\n> ??? l 58 checkout-cache.c says restore executable bit.\n> \n> -q\n> \tbe quiet if files exist or are not in the cache\n> \n> -f\n> \tforces overwrite of existing files\n> \n> -a\n> \tchecks out all files in the cache (will then continue to\n> \tprocess listed files).\n> -n\n> \tDon't checkout new files, only refresh files already checked\n> \tout.\n> \n> --prefix=<string>\n> \tWhen creating files, prepend <string> (usually a directory\n> \tincluding a trailing /)\n> \n> --\n> \tDo not interpret any more arguments as options.\n> \n> Note that the order of the flags matters:\n> \n> \tcheckout-cache -a -f file.c\n> \n> will first check out all files listed in the cache (but not overwrite\n> any old ones), and then force-checkout file.c a second time (ie that\n> one _will_ overwrite any old contents with the same filename).\n> \n> Also, just doing \"checkout-cache\" does nothing. You probably meant\n> \"checkout-cache -a\". And if you want to force it, you want\n> \"checkout-cache -f -a\".\n> \n> Intuitiveness is not the goal here. Repeatability is. The reason for\n> the \"no arguments means no work\" thing is that from scripts you are\n> supposed to be able to do things like\n> \n> \tfind . -name '*.h' -print0 | xargs -0 checkout-cache -f --\n> \n> which will force all existing *.h files to be replaced with their\n> cached copies. If an empty command line implied \"all\", then this would\n> force-refresh everything in the cache, which was not the point.\n> \n> To update and refresh only the files already checked out:\n> \n>    checkout-cache -n -f -a && update-cache --ignore-missing --refresh\n> \n> Oh, and the \"--\" is just a good idea when you know the rest will be\n> filenames. Just so that you wouldn't have a filename of \"-a\" causing\n> problems (not possible in the above example, but get used to it in\n> scripting!).\n> \n> The prefix ability basically makes it trivial to use checkout-cache as\n> a \"export as tree\" function. Just read the desired tree into the\n> index, and do a\n>   \n>         checkout-cache --prefix=export-dir/ -a\n>   \n> and checkout-cache will \"export\" the cache into the specified\n> directory.\n>   \n> NOTE! The final \"/\" is important. The exported name is literally just\n> prefixed with the specified string, so you can also do something like\n>   \n>         checkout-cache --prefix=.merged- Makefile\n>   \n> to check out the currently cached copy of \"Makefile\" into the file\n> \".merged-Makefile\".\n> \n> \n> ################################################################\n> commit-tree\n> \tcommit-tree <tree> [-p <parent commit>]*   < changelog\n> \n> Creates a new commit object based on the provided tree object and\n> emits the new commit object id on stdout. If no parent is given then\n> it is considered to be an initial tree.\n> \n> A commit object usually has 1 parent (a commit after a change) or up\n> to 16 parents.  More than one parent represents a merge of branches\n> that led to them.\n> \n> While a tree represents a particular directory state of a working\n> directory, a commit represents that state in \"time\", and explains how\n> to get there.\n> \n> Normally a commit would identify a new \"HEAD\" state, and while git\n> doesn't care where you save the note about that state, in practice we\n> tend to just write the result to the file \".git/HEAD\", so that we can\n> always see what the last committed state was.\n> \n> Options\n> \n> <tree>\n> \tAn existing tree object\n> \n> -p <parent commit>\n> \tEach -p indicates a the id of a parent commit object.\n> \t\n> \n> Commit Information\n> \n> A commit encapsulates:\n> \tall parent object ids\n> \tauthor name, email and date\n> \tcommitter name and email and the commit time.\n> \n> If not provided, commit-tree uses your name, hostname and domain to\n> provide author and committer info. This can be overridden using the\n> following environment variables.\n> \tAUTHOR_NAME\n> \tAUTHOR_EMAIL\n> \tAUTHOR_DATE\n> \tCOMMIT_AUTHOR_NAME\n> \tCOMMIT_AUTHOR_EMAIL\n> (nb <,> and '\\n's are stripped)\n> \n> A commit comment is read from stdin (max 999 chars). If a changelog\n> entry is not provided via '<' redirection, commit-tree will just wait\n> for one to be entered and terminated with ^D\n> \n> see also: write-tree\n> \n> \n> ################################################################\n> diff-cache\n> \tdiff-cache [-p] [-r] [-z] [--cached] <tree/commit>\n> \n> Compares the content and mode of the blobs found via a tree object\n> with the content of the current cache and, optionally ignoring the\n> stat state of the file on disk.\n> \n> <tree/commit>\n> \tThe id of a tree or commit object to diff against.\n> \n> -p\n> \tgenerate patch (see section on generating patches)\n> \n> -r\n> \trecurse\n> \n> -z\n> \t\\0 line termination on output\n> \n> --cached\n> \tdo not consider the on-disk file at all\n> \n> Output format:\n> \n> See \"Output format from diff-cache, diff-tree and show-diff\" section.\n> \n> Operating Modes\n> \n> You can choose whether you want to trust the index file entirely\n> (using the \"--cached\" flag) or ask the diff logic to show any files\n> that don't match the stat state as being \"tentatively changed\".  Both\n> of these operations are very useful indeed.\n> \n> Cached Mode\n> \n> If --cached is specified, it allows you to ask:\n> \tshow me the differences between HEAD and the current index\n> \tcontents (the ones I'd write with a \"write-tree\")\n> \n> For example, let's say that you have worked on your index file, and are\n> ready to commit. You want to see eactly _what_ you are going to commit is\n> without having to write a new tree object and compare it that way, and to\n> do that, you just do\n> \n> \tdiff-cache --cached $(cat .git/HEAD)\n> \n> Example: let's say I had renamed \"commit.c\" to \"git-commit.c\", and I had \n> done an \"upate-cache\" to make that effective in the index file. \n> \"show-diff\" wouldn't show anything at all, since the index file matches \n> my working directory. But doing a diff-cache does:\n> \ttorvalds@ppc970:~/git> diff-cache --cached $(cat .git/HEAD)\n> \t-100644 blob    4161aecc6700a2eb579e842af0b7f22b98443f74        commit.c\n> \t+100644 blob    4161aecc6700a2eb579e842af0b7f22b98443f74        git-commit.c\n> \n> And as you can see, the output matches \"diff-tree -r\" output (we\n> always do equivalent of \"-r\", since the index is flat).\n> You can trivially see that the above is a rename.\n> \n> In fact, \"diff-cache --cached\" _should_ always be entirely equivalent to\n> actually doing a \"write-tree\" and comparing that. Except this one is much\n> nicer for the case where you just want to check where you are.\n> \n> So doing a \"diff-cache --cached\" is basically very useful when you are \n> asking yourself \"what have I already marked for being committed, and \n> what's the difference to a previous tree\".\n> \n> Non-cached Mode\n> \n> The \"non-cached\" mode takes a different approach, and is potentially\n> the even more useful of the two in that what it does can't be emulated\n> with a \"write-tree + diff-tree\". Thus that's the default mode.  The\n> non-cached version asks the question\n> \n>    \"show me the differences between HEAD and the currently checked out \n>     tree - index contents _and_ files that aren't up-to-date\"\n> \n> which is obviously a very useful question too, since that tells you what\n> you _could_ commit. Again, the output matches the \"diff-tree -r\" output to\n> a tee, but with a twist.\n> \n> The twist is that if some file doesn't match the cache, we don't have a\n> backing store thing for it, and we use the magic \"all-zero\" sha1 to show\n> that. So let's say that you have edited \"kernel/sched.c\", but have not\n> actually done an update-cache on it yet - there is no \"object\" associated\n> with the new state, and you get:\n> \n> \ttorvalds@ppc970:~/v2.6/linux> diff-cache $(cat .git/HEAD )\n> \t*100644->100664 blob    7476bbcfe5ef5a1dd87d745f298b831143e4d77e->0000000000000000000000000000000000000000      kernel/sched.c\n> \n> ie it shows that the tree has changed, and that \"kernel/sched.c\" has is\n> not up-to-date and may contain new stuff. The all-zero sha1 means that to\n> get the real diff, you need to look at the object in the working directory\n> directly rather than do an object-to-object diff.\n> \n> NOTE! As with other commands of this type, \"diff-cache\" does not actually \n> look at the contents of the file at all. So maybe \"kernel/sched.c\" hasn't \n> actually changed, and it's just that you touched it. In either case, it's \n> a note that you need to upate-cache it to make the cache be in sync.\n> \n> NOTE 2! You can have a mixture of files show up as \"has been updated\" and\n> \"is still dirty in the working directory\" together. You can always tell\n> which file is in which state, since the \"has been updated\" ones show a\n> valid sha1, and the \"not in sync with the index\" ones will always have the\n> special all-zero sha1.\n> \n> ################################################################\n> diff-tree\n> \tdiff-tree [-p] [-r] [-z] <tree/commit> <tree/commit> [<pattern>]*\n> \n> Compares the content and mode of the blobs found via two tree objects.\n> \n> Note that diff-tree can use the tree encapsulated in a commit object.\n> \n> <tree sha1>\n> \tThe id of a tree or commit object.\n> \n> <pattern>\n> \n> \tIf provided, the results are limited to a subset of files\n> \tmatching one of these prefix strings.\n> \tie file matches /^<pattern1>|<pattern2>|.../\n> \tNote that pattern does not provide any wildcard or regexp features.\n> \n> -p\n> \tgenerate patch (see section on generating patches)\n> \n> -r\n> \trecurse\n> \n> -z\n> \t\\0 line termination on output\n> \n> Limiting Output\n> \n> If you're only interested in differences in a subset of files, for\n> example some architecture-specific files, you might do:\n> \n> \tdiff-tree -r <tree/commit> <tree/commit> arch/ia64 include/asm-ia64\n> \n> and it will only show you what changed in those two directories.\n> \n> Or if you are searching for what changed in just kernel/sched.c, just do\n> \n> \tdiff-tree -r <tree/commit> <tree/commit> kernel/sched.c\n> \n> and it will ignore all differences to other files.\n> \n> The pattern is always the prefix, and is matched exactly (ie there are no\n> wildcards - although matching a directory, which it does support, can\n> obviously be seen as a \"wildcard\" for all the files under that directory).\n> \n> Output format:\n> \n> See \"Output format from diff-cache, diff-tree and show-diff\" section.\n> \n> An example of normal usage is:\n> \n> \ttorvalds@ppc970:~/git> diff-tree 5319e4d609cdd282069cc4dce33c1db559539b03 b4e628ea30d5ab3606119d2ea5caeab141d38df7\n> \t*100664->100664 blob    ac348b7d5278e9d04e3a1cd417389379c32b014f->a01513ed4d4d565911a60981bfb4173311ba3688      fsck-cache.c\n> \n> which tells you that the last commit changed just one file (it's from\n> this one:\n> \n> \tcommit 3c6f7ca19ad4043e9e72fa94106f352897e651a8\n> \ttree 5319e4d609cdd282069cc4dce33c1db559539b03\n> \tparent b4e628ea30d5ab3606119d2ea5caeab141d38df7\n> \tauthor Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005\n> \tcommitter Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005\n> \n> \tMake \"fsck-cache\" print out all the root commits it finds.\n> \n> \tOnce I do the reference tracking, I'll also make it print out all the\n> \tHEAD commits it finds, which is even more interesting.\n> \n> in case you care).\n> \n> ################################################################\n> diff-tree-helper\n> \tdiff-tree-helper [-z]\n> \n> Reads output from diff-cache, diff-tree and show-diff and\n> generates patch format output.\n> \n> -z\n> \t\\0 line termination on input\n> \n> See also the section on generating patches.\n> \n> ################################################################\n> fsck-cache\n> \tfsck-cache [[--unreachable] <commit>*]\n> \n> Verifies the connectivity and validity of the objects in the database.\n> \n> <commit>\n> \tA commit object to treat as the head of an unreachability\n> \ttrace\n> \n> --unreachable\n> \tprint out objects that exist but that aren't readable from any\n> \tof the specified root nodes\n> \n> It tests SHA1 and general object sanity, but it does full tracking of\n> the resulting reachability and everything else. It prints out any\n> corruption it finds (missing or bad objects), and if you use the\n> \"--unreachable\" flag it will also print out objects that exist but\n> that aren't readable from any of the specified root nodes.\n> \n> So for example\n> \n> \tfsck-cache --unreachable $(cat .git/HEAD)\n> \n> or, for Cogito users:\n> \n> \tfsck-cache --unreachable $(cat .git/heads/*)\n> \n> will do quite a _lot_ of verification on the tree. There are a few\n> extra validity tests to be added (make sure that tree objects are\n> sorted properly etc), but on the whole if \"fsck-cache\" is happy, you\n> do have a valid tree.\n> \n> Any corrupt objects you will have to find in backups or other archives\n> (ie you can just remove them and do an \"rsync\" with some other site in\n> the hopes that somebody else has the object you have corrupted).\n> \n> Of course, \"valid tree\" doesn't mean that it wasn't generated by some\n> evil person, and the end result might be crap. Git is a revision\n> tracking system, not a quality assurance system ;)\n> \n> Extracted Diagnostics\n> \n> expect dangling commits - potential heads - due to lack of head information\n> \tYou haven't specified any nodes as heads so it won't be\n> \tpossible to differentiate between un-parented commits and\n> \troot nodes.\n> \n> missing sha1 directory '<dir>'\n> \tThe directory holding the sha1 objects is missing.\n> \n> unreachable <type> <object>\n> \tThe <type> object <object>, isn't actually referred to directly\n> \tor indirectly in any of the trees or commits seen. This can\n> \tmean that there's another root na SHA1_ode that you're not specifying\n> \tor that the tree is corrupt. If you haven't missed a root node\n> \tthen you might as well delete unreachable nodes since they\n> \tcan't be used.\n> \n> missing <type> <object>\n> \tThe <type> object <object>, is referred to but isn't present in\n> \tthe database.\n> \n> dangling <type> <object>\n> \tThe <type> object <object>, is present in the database but never\n> \t_directly_ used. A dangling commit could be a root node.\n> \n> warning: fsck-cache: tree <tree> has full pathnames in it\n> \tAnd it shouldn't...\n> \n> sha1 mismatch <object>\n> \tThe database has an object who's sha1 doesn't match the\n> \tdatabase value.\n> \tThis indicates a ??serious?? data integrity problem.\n> \t(note: this error occured during early git development when\n> \tthe database format changed.)\n> \n> Environment Variables\n> \n> SHA1_FILE_DIRECTORY\n> \tused to specify the object database root (usually .git/objects)\n> \n> ################################################################\n> git-export\n> \tgit-export top [base]\n> \n> probably deprecated:\n> On Wed, 20 Apr 2005, Petr Baudis wrote:\n> \n>>>I will probably not buy git-export, though. (That is, it is merged, but\n>>>I won't make git frontend for it.) My \"git export\" already does\n>>>something different, but more importantly, \"git patch\" of mine already\n>>>does effectively the same thing as you do, just for a single patch; so I\n>>>will probably just extend it to do it for an (a,b] range of patches.\n> \n> \n> \n> That's fine. It was a quick hack, just to show that if somebody wants to, \n> the data is trivially exportable.\n> \n> \t\tLinus\n> \n> Although in Linus' distribution, git-export is not part of 'core' git.\n> \n> ################################################################\n> init-db\n> \tinit-db\n> \n> This simply creates an empty git object database - basically a .git\n> directory.\n> \n> If the object storage directory is specified via the\n> SHA1_FILE_DIRECTORY environment variable then the sha1 directories are\n> created underneath - otherwise the default .git/objects directory is\n> used.\n> \n> init-db won't hurt an existing repository.\n> \n> \n> ################################################################\n> ls-tree\n> \tls-tree [-r] [-z] <tree/commit>\n> \n> convert the tree object to a human readable (and script\n> processable) form.\n> \n> <tree/commit>\n> \tId of a tree or commit object.\n> -r\n> \trecurse into sub-trees\n> \n> -z\n> \t\\0 line termination on output\n> \n> Output Format\n> <mode>\\t\t<type>\\t\t<object>\\t\t<path><file>\t\n> \n> \n> ################################################################\n> merge-base\n> \tmerge-base <commit> <commit>\n> \n> merge-base finds as good a common ancestor as possible. Given a\n> selection of equally good common ancestors it should not be relied on\n> to decide in any particular way.\n> \n> The merge-base algorithm is still in flux - use the source...\n> \n> \n> ################################################################\n> merge-cache\n> \tmerge-cache <merge-program> (-a | -- | <file>*) \n> \n> This looks up the <file>(s) in the cache and, if there are any merge\n> entries, unpacks all of them (which may be just one file, of course)\n> into up to three separate temporary files, and then executes the\n> supplied <merge-program> with those three files as arguments 1,2,3\n> (empty argument if no file), and <file> as argument 4.\n> \n> --\n> \tInterpret all future arguments as filenames\n> \n> -a\n> \tRun merge against all files in the cache that need merging.\n> \n> If merge-cache is called with multiple <file>s (or -a) then it\n> processes them in turn only stopping if merge returns a non-zero exit\n> code.\n> \n> Typically this is run with the a script calling the merge command from\n> the RCS package.\n> \n> A sample script called git-merge-one-file-script is included in the\n> ditribution.\n> \n> ALERT ALERT ALERT! The git \"merge object order\" is different from the\n> RCS \"merge\" program merge object order. In the above ordering, the\n> original is first. But the argument order to the 3-way merge program\n> \"merge\" is to have the original in the middle. Don't ask me why.\n> \n> Examples:\n> \n> \ttorvalds@ppc970:~/merge-test> merge-cache cat MM\n> \tThis is MM from the original tree.\t\t\t# original\n> \tThis is modified MM in the branch A.\t\t\t# merge1\n> \tThis is modified MM in the branch B.\t\t\t# merge2\n> \tThis is modified MM in the branch B.\t\t\t# current contents\n> \n> or \n> \n> \ttorvalds@ppc970:~/merge-test> merge-cache cat AA MM\n> \tcat: : No such file or directory\n> \tThis is added AA in the branch A.\n> \tThis is added AA in the branch B.\n> \tThis is added AA in the branch B.\n> \tfatal: merge program failed\n> \n> where the latter example shows how \"merge-cache\" will stop trying to\n> merge once anything has returned an error (ie \"cat\" returned an error\n> for the AA file, because it didn't exist in the original, and thus\n> \"merge-cache\" didn't even try to merge the MM thing).\n> \n> \n> ################################################################\n> read-tree\n> \tread-tree (<tree/commit> | -m <tree/commit1> [<tree/commit2> <tree/commit3>])\"\n> \n> Reads the tree information given by <tree> into the directory cache,\n> but does not actually _update_ any of the files it \"caches\". (see:\n> checkout-cache)\n> \n> Optionally, it can merge a tree into the cache or perform a 3-way\n> merge.\n> \n> Trivial merges are done by read-tree itself.  Only conflicting paths\n> will be in unmerged state when read-tree returns.\n> \n> -m\n> \tPerform a merge, not just a read\n> \n> <tree#>\n> \tThe id of the tree object(s) to be read/merged.\n> \n> \n> Merging\n> If -m is specified, read-tree performs 2 kinds of merge, a single tree\n> merge if only 1 tree is given or a 3-way merge if 3 trees are\n> provided.\n> \n> Single Tree Merge\n> If only 1 tree is specified, read-tree operates as if the user did not\n> specify \"-m\", except that if the original cache has an entry for a\n> given pathname; and the contents of the path matches with the tree\n> being read, the stat info from the cache is used. (In other words, the\n> cache's stat()s take precedence over the merged tree's)\n> \n> That means that if you do a \"read-tree -m <newtree>\" followed by a\n> \"checkout-cache -f -a\", the checkout-cache only checks out the stuff\n> that really changed.\n> \n> This is used to avoid unnecessary false hits when show-diff is\n> run after read-tree.\n> \n> 3-Way Merge\n> Each \"index\" entry has two bits worth of \"stage\" state. stage 0 is the\n> normal one, and is the only one you'd see in any kind of normal use.\n> \n> However, when you do \"read-tree\" with multiple trees, the \"stage\"\n> starts out at 0, but increments for each tree you read. And in\n> particular, the \"-m\" flag means \"start at stage 1\" instead.\n> \n> This means that you can do\n> \n> \tread-tree -m <tree1> <tree2> <tree3>\n> \n> and you will end up with an index with all of the <tree1> entries in\n> \"stage1\", all of the <tree2> entries in \"stage2\" and all of the\n> <tree3> entries in \"stage3\".\n> \n> Furthermore, \"read-tree\" has special-case logic that says: if you see\n> a file that matches in all respects in the following states, it\n> \"collapses\" back to \"stage0\":\n> \n>    - stage 2 and 3 are the same; take one or the other (it makes no\n>      difference - the same work has been done on stage 2 and 3)\n> \n>    - stage 1 and stage 2 are the same and stage 3 is different; take\n>      stage 3 (some work has been done on stage 3)\n> \n>    - stage 1 and stage 3 are the same and stage 2 is different take\n>      stage 2 (some work has been done on stage 2)\n> \n> Write-tree refuses to write a nonsensical tree, so write-tree will\n> complain about unmerged entries if it sees a single entry that is not\n> stage 0\".\n> \n> Ok, this all sounds like a collection of totally nonsensical rules,\n> but it's actually exactly what you want in order to do a fast\n> merge. The different stages represent the \"result tree\" (stage 0, aka\n> \"merged\"), the original tree (stage 1, aka \"orig\"), and the two trees\n> you are trying to merge (stage 2 and 3 respectively).\n> \n> In fact, the way \"read-tree\" works, it's entirely agnostic about how\n> you assign the stages, and you could really assign them any which way,\n> and the above is just a suggested way to do it (except since\n> \"write-tree\" refuses to write anything but stage0 entries, it makes\n> sense to always consider stage 0 to be the \"full merge\" state).\n> \n> So what happens? Try it out. Select the original tree, and two trees\n> to merge, and look how it works:\n> \n>  - if a file exists in identical format in all three trees, it will \n>    automatically collapse to \"merged\" state by the new read-tree.\n> \n>  - a file that has _any_ difference what-so-ever in the three trees\n>    will stay as separate entries in the index. It's up to \"script\n>    policy\" to determine how to remove the non-0 stages, and insert a\n>    merged version.  But since the index is always sorted, they're easy\n>    to find: they'll be clustered together.\n> \n>  - the index file saves and restores with all this information, so you\n>    can merge things incrementally, but as long as it has entries in\n>    stages 1/2/3 (ie \"unmerged entries\") you can't write the result.\n> \n> So now the merge algorithm ends up being really simple:\n> \n>  - you walk the index in order, and ignore all entries of stage 0,\n>    since they've already been done.\n> \n>  - if you find a \"stage1\", but no matching \"stage2\" or \"stage3\", you\n>    know it's been removed from both trees (it only existed in the\n>    original tree), and you remove that entry.  - if you find a\n>    matching \"stage2\" and \"stage3\" tree, you remove one of them, and\n>    turn the other into a \"stage0\" entry. Remove any matching \"stage1\"\n>    entry if it exists too.  .. all the normal trivial rules ..\n> \n> Incidentally - it also means that you don't even have to have a separate \n> subdirectory for this. All the information literally is in the index file, \n> which is a temporary thing anyway. There is no need to worry about what is in \n> the working directory, since it is never shown and never used.\n> \n> see also:\n> write-tree\n> show-files\n> \n> \n> ################################################################\n> rev-list <commit>\n> \n> Lists commit objects in reverse chronological order starting at the\n> given commit, taking ancestry relationship into account.  This is\n> useful to produce human-readable log output.\n> \n> \n> ################################################################\n> rev-tree\n> \trev-tree [--edges] [--cache <cache-file>] [^]<commit> [[^]<commit>]\n> \n> Provides the revision tree for one or more commits.\n> \n> --edges\n> \tShow edges (ie places where the marking changes between parent\n> \tand child)\n> \n> --cache <cache-file>\n> \tUse the specified file as a cache. [Not implemented yet]\n> \n> [^]<commit>\n> \tThe commit id to trace (a leading caret means to ignore this\n> \tcommit-id and below)\n> \n> Output:\n> <date> <commit>:<flags> [<parent-commit>:<flags> ]*\n> \n> <date>\n> \tDate in 'seconds since epoch'\n> \n> <commit>\n> \tid of commit object\n> \n> <parent-commit>\n> \tid of each parent commit object (>1 indicates a merge)\n> \n> <flags>\n> \n> \tThe flags are read as a bitmask representing each commit\n> \tprovided on the commandline. eg: given the command:\n> \n> \t\t $ rev-tree <com1> <com2> <com3>\n> \n> \tThe output:\n> \n> \t    <date> <commit>:5\n> \n> \t means that <commit> is reachable from <com1>(1) and <com3>(4)\n> \t\n> A revtree can get quite large. rev-tree will eventually allow you to\n> cache previous state so that you don't have to follow the whole thing\n> down.\n> \n> So the change difference between two commits is literally\n> \n> \trev-tree [commit-id1]  > commit1-revtree\n> \trev-tree [commit-id2]  > commit2-revtree\n> \tjoin -t : commit1-revtree commit2-revtree > common-revisions\n> \n> (this is also how to find the most common parent - you'd look at just\n> the head revisions - the ones that aren't referred to by other\n> revisions - in \"common-revision\", and figure out the best one. I\n> think.)\n> \n> \n> ################################################################\n> show-diff\n> \tshow-diff [-p] [-q] [-s] [-z] [paths...]\n> \n> Compares the files in the working tree and the cache.  When paths\n> are specified, compares only those named paths.  Otherwise all\n> entries in the cache are compared.  The output format is the\n> same as diff-cache and diff-tree.\n> \n> -p\n> \tgenerate patch (see section on generating patches)\n> \n> -q\n> \tRemain silent even on nonexisting files\n> \n> -s\n> \tDoes not do anything other than what -q does.\n> \n> Output format:\n> \n> See \"Output format from diff-cache, diff-tree and show-diff\" section.\n> \n> ################################################################\n> show-files\n> \tshow-files [-z] [-t]\n> \t\t(--[cached|deleted|others|ignored|stage|unmerged])*\n> \t\t(-[c|d|o|i|s|u])*\n> \t\t[-x <pattern>|--exclude=<pattern>]\n> \t\t[-X <file>|--exclude-from=<file>]\n> \n> This merges the file listing in the directory cache index with the\n> actual working directory list, and shows different combinations of the\n> two.\n> \n> One or more of the options below may be used to determine the files\n> shown:\n> \n> -c|--cached\n> \tShow cached files in the output (default)\n> \n> -d|--deleted\n> \tShow deleted files in the output\n> \n> -o|--others\n> \tShow other files in the output\n> \n> -i|--ignored\n> \tShow ignored files in the output\n> \tNote the this also reverses any exclude list present.\n> \n> -s|--stage\n> \tShow stage files in the output\n> \n> -u|--unmerged\n> \tShow unmerged files in the output (forces --stage)\n> \n> #-t [not in Linus' tree (yet?)]\n> #\tIdentify the file status with the following tags (followed by\n> #\ta space) at the start of each line:\n> #\tH\tcached\n> #\tM\tunmerged\n> #\tR\tremoved/deleted\n> #\t?\tother\n> \n> -z\n> \t\\0 line termination on output\n> \n> -x|--exclude=<pattern>\n> \tSkips files matching pattern.\n> \tNote that pattern is a shell wildcard pattern.\n> \n> -X|--exclude-from=<file>\n> \texclude patterns are read from <file>; 1 per line.\n> \tAllows the use of the famous dontdiff file as follows to find\n> \tout about uncommitted files just as dontdiff is used with\n> \tthe diff command:\n> \t     show-files --others --exclude-from=dontdiff\n> \n> Output\n> show files just outputs the filename unless --stage is specified in\n> which case it outputs:\n> \n> [<tag> ]<mode> <object> <stage> <file>\n> \n> show-files --unmerged\" and \"show-files --stage \" can be used to examine\n> detailed information on unmerged paths.\n> \n> For an unmerged path, instead of recording a single mode/SHA1 pair,\n> the dircache records up to three such pairs; one from tree O in stage\n> 1, A in stage 2, and B in stage 3.  This information can be used by\n> the user (or Cogito) to see what should eventually be recorded at the\n> path. (see read-cache for more information on state)\n> \n> see also:\n> read-cache\n> \n> \n> ################################################################\n> unpack-file\n> \tunpack-file <blob>\n> \n> Creates a file holding the contents of the blob specified by sha1. It\n> returns the name of the temporary file in the following format:\n> \t.merge_file_XXXXX\n> \n> <blob>\n> \tMust be a blob id\n> \n> ################################################################\n> update-cache\n> \tupdate-cache [--add] [--remove] [--refresh [--ignore-missing]]\n> \t\t     [--cacheinfo <mode> <object> <path>]*\n> \t\t     [--] [<file>]*\n> \n> Modifies the index or directory cache. Each file mentioned is updated\n> into the cache and any 'unmerged' or 'needs updating' state is\n> cleared.\n> \n> The way update-cache handles files it is told about can be modified\n> using the various options:\n> \n> --add\n> \tIf a specified file isn't in the cache already then it's\n> \tadded.\n> \tDefault behaviour is to ignore new files.\n> \n> --remove\n> \tIf a specified file is in the cache but is missing then it's\n> \tremoved.\n> \tDefault behaviour is to ignore removed file.\n> \n> --refresh\n> \tLooks at the current cache and checks to see if merges or\n> \tupdates are needed by checking stat() information.\n> \n> --ignore-missing\n> \tIgnores missing files during a --refresh\n> \n> --cacheinfo <mode> <object> <path>\n> \tDirectly insert the specified info into the cache.\n> \t\n> --\n> \tDo not interpret any more arguments as options.\n> \n> <file>\n> \tFiles to act on.\n> \tNote that files begining with '.' are discarded. This includes\n> \t\"./file\" and \"dir/./file\". If you don't want this, then use\t\n> \tcleaner names.\n> \tThe same applies to directories ending '/' and paths with '//'\n> \n> \n> Using --refresh\n> \n> --refresh does not calculate a new sha1 file or bring the cache\n> up-to-date for mode/content changes. But what it _does_ do is to\n> \"re-match\" the stat information of a file with the cache, so that you\n> can refresh the cache for a file that hasn't been changed but where\n> the stat entry is out of date.\n> \n> For example, you'd want to do this after doing a \"read-tree\", to link\n> up the stat cache details with the proper files.\n> \n> Using --cacheinfo\n> --cacheinfo is used to register a file that is not in the current\n> working directory.  This is useful for minimum-checkout merging.\n> \n> To pretend you have a file with mode and sha1 at path, say:\n> \n>  $ update-cache --cacheinfo mode sha1 path\n> \n> To update and refresh only the files already checked out:\n> \n>    checkout-cache -n -f -a && update-cache --ignore-missing --refresh\n> \n> \n> ################################################################\n> write-tree\n> \twrite-tree\n> \n> Creates a tree object using the current cache.\n> \n> The cache must be merged.\n> \n> Conceptually, write-tree sync()s the current directory cache contents\n> into a set of tree files.\n> In order to have that match what is actually in your directory right\n> now, you need to have done a \"update-cache\" phase before you did the\n> \"write-tree\".\n> \n> \n> ################################################################\n> \n> Output format from diff-cache, diff-tree and show-diff.\n> \n> These commands all compare two sets of things; what are\n> compared are different:\n> \n>     diff-cache <tree/commit>\n> \n>         compares the <tree/commit> and the files on the filesystem.\n> \n>     diff-cache --cached <tree/commit>\n> \n>         compares the <tree/commit> and the cache.\n> \n>     diff-tree [-r] <tree/commit-1> <tree/commit-2> [paths...]\n> \n>         compares the trees named by the two arguments.\n> \n>     show-diff [paths...]\n> \n>         compares the cache and the files on the filesystem.\n> \n> The following desription uses \"old\" and \"new\" to mean those\n> compared entities.\n> \n> For files in old but not in new (i.e. removed):\n> -<mode> \\t <type> \\t <object> \\t <path>\n> \n> For files not in old but in new (i.e. added):\n> +<mode> \\t <type> \\t <object> \\t <path>\n> \n> For files that differ:\n> *<old-mode>-><new-mode> \\t <type> \\t <old-sha1>-><new-sha1> \\t <path>\n> \n> <new-sha1> is shown as all 0's if new is a file on the\n> filesystem and it is out of sync with the cache.  Example:\n> \n>     *100644->100660 blob    5be4a414b32cf4204f889469942986d3d783da84->0000000000000000000000000000000000000000      file.c\n> \n> ################################################################\n> \n> Generating patches\n> \n> When diff-cache, diff-tree, or show-diff are run with a -p\n> option, they do not produce the output described in \"Output\n> format from diff-cache, diff-tree and show-diff\" section.  It\n> instead produces a patch file.\n> \n> The patch generation can be customized at two levels.  This\n> customization also applies to diff-tree-helper.\n> \n> 1. When the environment variable GIT_EXTERNAL_DIFF is not set,\n>    these commands internally invoke diff like this:\n> \n>    diff -L k/<path> -L l/<path> -pu <old> <new>\n> \n>    For added files, /dev/null is used for <old>.  For removed\n>    files, /dev/null is used for <new>\n> \n>    The first part of the above command-line can be customized via\n>    the environment variable GIT_DIFF_CMD.  For example, if you\n>    do not want to show the extra level of leading path, you can\n>    say this:\n> \n>    GIT_DIFF_CMD=\"diff -L'%s' -L'%s'\" show-diff -p\n> \n>    Caution:  Do not use more than two '%s' in GIT_DIFF_CMD.\n> \n>    The diff formatting options can be customized via the\n>    environment variable GIT_DIFF_OPTS.  For example, if you\n>    prefer context diff:\n> \n>    GIT_DIFF_OPTS=-c diff-cache -p $(cat .git/HEAD)\n> \n> \n> 2. When the environment variable GIT_EXTERNAL_DIFF is set, the\n>    program named by it is called, instead of the diff invocation\n>    described above.\n> \n>    For a path that is added, removed, or modified,\n>    GIT_EXTERNAL_DIFF is called with 7 parameters:\n> \n>      path old-file old-hex old-mode new-file new-hex new-mode\n> \n>    where\n>      <old|new>-file are files GIT_EXTERNAL_DIFF can use to read the\n>                     contents of <old|ne>,\n>      <old|new>-hex are the 40-hexdigit SHA1 hashes,\n>      <old|new>-mode are the octal representation of the file modes.\n> \n>    The file parameters can point at the user's working file\n>    (e.g. new-file in show-diff), /dev/null (e.g. old-file when a\n>    new file is added), or a temporary file (e.g. old-file in the\n>    cache).  GIT_EXTERNAL_DIFF should not worry about\n>    unlinking the temporary file --- it is removed when\n>    GIT_EXTERNAL_DIFF exits.\n> \n>    For a path that is unmerged, GIT_EXTERNAL_DIFF is called with\n>    1 parameter, path.\n> \n> ################################################################\n> \n> Terminology: - see README for description\n> Each line contains terms used interchangeably\n> \n> object database, .git directory\n> directory cache, index\n> id, sha1, sha1-id, sha1 hash\n> type, tag\n> blob, blob object\n> tree, tree object\n> commit, commit object\n> parent\n> root object\n> changeset\n> \n> \n> git Environment Variables\n> AUTHOR_NAME\n> AUTHOR_EMAIL\n> AUTHOR_DATE\n> COMMIT_AUTHOR_NAME\n> COMMIT_AUTHOR_EMAIL\n> GIT_DIFF_CMD\n> GIT_DIFF_OPTS\n> GIT_EXTERNAL_DIFF\n> GIT_INDEX_FILE\n> SHA1_FILE_DIRECTORY\n> \n\n-- \nmit freundlichen Grüßen, Brian.\n\nDr. Brian O'Mahoney\nMobile +41 (0)79 334 8035 Email: omb@bluewin.ch\nBleicherstrasse 25, CH-8953 Dietikon, Switzerland\nPGP Key fingerprint = 33 41 A2 DE 35 7C CE 5D  F5 14 39 C9 6D 38 56 D5\n"},{"id":"2296","messageId":"4274FB3F.8090206@dgreaves.com","threadId":"418","inReplyTo":"4274F373.6030001@khandalf.com","subject":"Re: Quick command reference","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-05-01T15:52:31Z","receivedAt":"2005-05-01T15:52:31Z","isPatch":false,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Brian O'Mahoney wrote:\n\n>Thank you both for taking the time and trouble to do this, particularly\n>with the name changes and new options; why don't you merge your efforts\n>and produce a GIT-Mini-HOWTO BTW send it off as a patch again!\n>  \n>\nI will happily work on this as soon as Linus says that he'll accept it.\nThat way when people make changes to the options and behaviour of\ncommands they can trivially update the README.reference too.\n\nPetr accepted an early version but then it became 'core git' rather than\nCogito so it made more sense to put it in Linus' tree.\n\nI don't know if Linus just doesn't get my mails (ISPs?) or if he's not\nbothered about docs right now? or he's plain busy?\n\nI've spent many many hours doing this and I'm happy to spend many more -\nbut I'm at that frustrated point where it makes no sense until I know\nit's of use.\n\nFingers crossed :)\n\nDavid\n\n"},{"id":"2298","messageId":"Pine.LNX.4.58.0505010927040.2296@ppc970.osdl.org","threadId":"418","inReplyTo":"4274FB3F.8090206@dgreaves.com","subject":"Re: Quick command reference","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-05-01T16:29:23Z","receivedAt":"2005-05-01T16:29:23Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 1 May 2005, David Greaves wrote:\n> \n> I've spent many many hours doing this and I'm happy to spend many more -\n> but I'm at that frustrated point where it makes no sense until I know\n> it's of use.\n\nI just tend to be concentrating on the technology itself, so docs \ninvariably fall a bit behind for me, until I get to the point where I \nstart looking at what (for me) ends up being the secondary things.\n\nAnyway, what I'd really appreciate is a whole \"Documentation\" \nsubdirectory, and preferably in some standard format. Maybe real \nold-fashioned man-pages, but hey, especially with something like this, \njust html would be good too.\n\n(And no, by \"standard format\" I do _not_ mean xml or stuff like that. I \nmean something that is actually easy to read ;)\n\n\t\tLinus\n"},{"id":"2301","messageId":"42750D06.70004@dgreaves.com","threadId":"418","inReplyTo":"Pine.LNX.4.58.0505010927040.2296@ppc970.osdl.org","subject":"Re: Quick command reference","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-05-01T17:08:22Z","receivedAt":"2005-05-01T17:08:22Z","isPatch":false,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Linus Torvalds wrote:\n\n>On Sun, 1 May 2005, David Greaves wrote:\n>  \n>\n>>I've spent many many hours doing this and I'm happy to spend many more -\n>>but I'm at that frustrated point where it makes no sense until I know\n>>it's of use.\n>>    \n>>\n>I just tend to be concentrating on the technology itself, so docs \n>invariably fall a bit behind for me, until I get to the point where I \n>start looking at what (for me) ends up being the secondary things.\n>  \n>\nYep - I expected as much. That's why _I_ did the README. Not sexy but\nsince I needed it, I figured others would...\nAnd frankly I've been trying to balance badgering without being annoying\n- but you keep saying what a thick skin you have so WTH, I kept on at it :)\n\n>Anyway, what I'd really appreciate is a whole \"Documentation\" \n>subdirectory, and preferably in some standard format. Maybe real \n>old-fashioned man-pages, but hey, especially with something like this, \n>just html would be good too.\n>  \n>\nThat was the intent... it was supposed to look manpage-ish.\nIt's all in one file for now to make it easier to skip around and\ncut'n'paste.\n(Good job too since the command names still aren't stable.)\n\n>(And no, by \"standard format\" I do _not_ mean xml or stuff like that. I \n>mean something that is actually easy to read ;)\n>  \n>\nI chose text to start since it could easily be read on the mailing list.\nI'll gladly put it into some kind of markup later when the features\nstart to stabilise.\nFor now people can wrap it in <pre> tags.\n\nPlease commit the version below (into a Documentation dir) and then all\nI have to do is send you patches to commit and you don't have to put too\nmuch effort into keeping it updated. It's 'only' docs - so although I\nmay get it wrong, people like Junio will be sure to correct me.\n\nIf you're OK with it then I can accept patches and track comments on the\nlist and act as collator/sub-editor. I can also do housekeeping like\nkeeping usage() strings consistent with the docs.\n\nWhat say you?\n\nDavid\n\nReference documentation for the core git commands.\n\nSigned-off-by: David Greaves <david@dgreaves.com>\n\n---\n\n\n\n\nThis file contains reference information for the core git commands.\nIt is actually based on the source from Petr Baudis' tree and may\ntherefore contain a few 'extras' that may or may not make it upstream.\n\nThe README contains much useful definition and clarification info -\nread that first.  And of the commands, I suggest reading\n'update-cache' and 'read-tree' first - I wish I had!\n\nThanks to original email authors and proof readers esp Junio C Hamano\n<junkio@cox.net>\n\nDavid Greaves <david@dgreaves.com>\n24/4/05\n\nIdentifier terminology used:\n\n<object>\n\tIndicates any object sha1 identifier\n\n<blob>\n\tIndicates a blob object sha1 identifier\n\n<tree>\n\tIndicates a tree object sha1 identifier\n\n<commit>\n\tIndicates a commit object sha1 identifier\n\n<tree/commit>\n\tIndicates a tree or commit object sha1 identifier (usually\n\tbecause the command can read the <tree> a <commit> contains).\n\t[Eventually may be replaced with <tree> if <tree> means\n\t<tree/commit> in all commands]\n\n<type>\n\tIndicates that an object type is required.\n\tCurrently one of: blob/tree/commit\n\n<file>\n\tIndicates a filename - often includes leading path\n\n<path>\n\tIndicates the path of a file (is this ever useful?)\n\n\n\n################################################################\ncat-file\n\tcat-file (-t | <type>) <object>\n\nProvide contents or type of objects in the repository. The type is\nrequired if -t is not being used to find the object type.\n\n<object>\n\tThe sha1 identifier of the object.\n\n-t\n\tshow the object type identified by <object>\n\n<type>\n\tOne of: blob/tree/commit\n\nOutput\n\nIf -t is specified, one of:\n        blob/tree/commit\n\nOtherwise the raw (though uncompressed) contents of the <object> will\nbe returned.\n\n\n################################################################\ncheck-files\n\tcheck-files <file>...\n\nCheck that a list of files are up-to-date between the filesystem and\nthe cache. Used to verify a patch target before doing a patch.\n\nFiles that do not exist on the filesystem are considered up-to-date\n(whether or not they are in the cache).\n\nEmits an error message on failure.\npreparing to update existing file <file> not in cache\n\t  <file> exists but is not in the cache\n\npreparing to update file <file> not uptodate in cache\n\t  <file> on disk is not up-to-date with the cache\n\nexits with a status code indicating success if all files are\nup-to-date.\n\nsee also: update-cache\n\n\n################################################################\ncheckout-cache\n\tcheckout-cache [-q] [-a] [-f] [-n] [--prefix=<string>]\n\t\t       [--] <file>...\n\nWill copy all files listed from the cache to the working directory\n(not overwriting existing files). Note that the file contents are\nrestored - NOT the file permissions.\n??? l 58 checkout-cache.c says restore executable bit.\n\n-q\n\tbe quiet if files exist or are not in the cache\n\n-f\n\tforces overwrite of existing files\n\n-a\n\tchecks out all files in the cache (will then continue to\n\tprocess listed files).\n-n\n\tDon't checkout new files, only refresh files already checked\n\tout.\n\n--prefix=<string>\n\tWhen creating files, prepend <string> (usually a directory\n\tincluding a trailing /)\n\n--\n\tDo not interpret any more arguments as options.\n\nNote that the order of the flags matters:\n\n\tcheckout-cache -a -f file.c\n\nwill first check out all files listed in the cache (but not overwrite\nany old ones), and then force-checkout file.c a second time (ie that\none _will_ overwrite any old contents with the same filename).\n\nAlso, just doing \"checkout-cache\" does nothing. You probably meant\n\"checkout-cache -a\". And if you want to force it, you want\n\"checkout-cache -f -a\".\n\nIntuitiveness is not the goal here. Repeatability is. The reason for\nthe \"no arguments means no work\" thing is that from scripts you are\nsupposed to be able to do things like\n\n\tfind . -name '*.h' -print0 | xargs -0 checkout-cache -f --\n\nwhich will force all existing *.h files to be replaced with their\ncached copies. If an empty command line implied \"all\", then this would\nforce-refresh everything in the cache, which was not the point.\n\nTo update and refresh only the files already checked out:\n\n   checkout-cache -n -f -a && update-cache --ignore-missing --refresh\n\nOh, and the \"--\" is just a good idea when you know the rest will be\nfilenames. Just so that you wouldn't have a filename of \"-a\" causing\nproblems (not possible in the above example, but get used to it in\nscripting!).\n\nThe prefix ability basically makes it trivial to use checkout-cache as\na \"export as tree\" function. Just read the desired tree into the\nindex, and do a\n  \n        checkout-cache --prefix=export-dir/ -a\n  \nand checkout-cache will \"export\" the cache into the specified\ndirectory.\n  \nNOTE! The final \"/\" is important. The exported name is literally just\nprefixed with the specified string, so you can also do something like\n  \n        checkout-cache --prefix=.merged- Makefile\n  \nto check out the currently cached copy of \"Makefile\" into the file\n\".merged-Makefile\".\n\n\n################################################################\ncommit-tree\n\tcommit-tree <tree> [-p <parent commit>]*   < changelog\n\nCreates a new commit object based on the provided tree object and\nemits the new commit object id on stdout. If no parent is given then\nit is considered to be an initial tree.\n\nA commit object usually has 1 parent (a commit after a change) or up\nto 16 parents.  More than one parent represents a merge of branches\nthat led to them.\n\nWhile a tree represents a particular directory state of a working\ndirectory, a commit represents that state in \"time\", and explains how\nto get there.\n\nNormally a commit would identify a new \"HEAD\" state, and while git\ndoesn't care where you save the note about that state, in practice we\ntend to just write the result to the file \".git/HEAD\", so that we can\nalways see what the last committed state was.\n\nOptions\n\n<tree>\n\tAn existing tree object\n\n-p <parent commit>\n\tEach -p indicates a the id of a parent commit object.\n\t\n\nCommit Information\n\nA commit encapsulates:\n\tall parent object ids\n\tauthor name, email and date\n\tcommitter name and email and the commit time.\n\nIf not provided, commit-tree uses your name, hostname and domain to\nprovide author and committer info. This can be overridden using the\nfollowing environment variables.\n\tAUTHOR_NAME\n\tAUTHOR_EMAIL\n\tAUTHOR_DATE\n\tCOMMIT_AUTHOR_NAME\n\tCOMMIT_AUTHOR_EMAIL\n(nb <,> and '\\n's are stripped)\n\nA commit comment is read from stdin (max 999 chars). If a changelog\nentry is not provided via '<' redirection, commit-tree will just wait\nfor one to be entered and terminated with ^D\n\nsee also: write-tree\n\n\n################################################################\ndiff-cache\n\tdiff-cache [-p] [-r] [-z] [--cached] <tree/commit>\n\nCompares the content and mode of the blobs found via a tree object\nwith the content of the current cache and, optionally ignoring the\nstat state of the file on disk.\n\n<tree/commit>\n\tThe id of a tree or commit object to diff against.\n\n-p\n\tgenerate patch (see section on generating patches)\n\n-r\n\trecurse\n\n-z\n\t\\0 line termination on output\n\n--cached\n\tdo not consider the on-disk file at all\n\nOutput format:\n\nSee \"Output format from diff-cache, diff-tree and show-diff\" section.\n\nOperating Modes\n\nYou can choose whether you want to trust the index file entirely\n(using the \"--cached\" flag) or ask the diff logic to show any files\nthat don't match the stat state as being \"tentatively changed\".  Both\nof these operations are very useful indeed.\n\nCached Mode\n\nIf --cached is specified, it allows you to ask:\n\tshow me the differences between HEAD and the current index\n\tcontents (the ones I'd write with a \"write-tree\")\n\nFor example, let's say that you have worked on your index file, and are\nready to commit. You want to see eactly _what_ you are going to commit is\nwithout having to write a new tree object and compare it that way, and to\ndo that, you just do\n\n\tdiff-cache --cached $(cat .git/HEAD)\n\nExample: let's say I had renamed \"commit.c\" to \"git-commit.c\", and I had \ndone an \"upate-cache\" to make that effective in the index file. \n\"show-diff\" wouldn't show anything at all, since the index file matches \nmy working directory. But doing a diff-cache does:\n\ttorvalds@ppc970:~/git> diff-cache --cached $(cat .git/HEAD)\n\t-100644 blob    4161aecc6700a2eb579e842af0b7f22b98443f74        commit.c\n\t+100644 blob    4161aecc6700a2eb579e842af0b7f22b98443f74        git-commit.c\n\nAnd as you can see, the output matches \"diff-tree -r\" output (we\nalways do equivalent of \"-r\", since the index is flat).\nYou can trivially see that the above is a rename.\n\nIn fact, \"diff-cache --cached\" _should_ always be entirely equivalent to\nactually doing a \"write-tree\" and comparing that. Except this one is much\nnicer for the case where you just want to check where you are.\n\nSo doing a \"diff-cache --cached\" is basically very useful when you are \nasking yourself \"what have I already marked for being committed, and \nwhat's the difference to a previous tree\".\n\nNon-cached Mode\n\nThe \"non-cached\" mode takes a different approach, and is potentially\nthe even more useful of the two in that what it does can't be emulated\nwith a \"write-tree + diff-tree\". Thus that's the default mode.  The\nnon-cached version asks the question\n\n   \"show me the differences between HEAD and the currently checked out \n    tree - index contents _and_ files that aren't up-to-date\"\n\nwhich is obviously a very useful question too, since that tells you what\nyou _could_ commit. Again, the output matches the \"diff-tree -r\" output to\na tee, but with a twist.\n\nThe twist is that if some file doesn't match the cache, we don't have a\nbacking store thing for it, and we use the magic \"all-zero\" sha1 to show\nthat. So let's say that you have edited \"kernel/sched.c\", but have not\nactually done an update-cache on it yet - there is no \"object\" associated\nwith the new state, and you get:\n\n\ttorvalds@ppc970:~/v2.6/linux> diff-cache $(cat .git/HEAD )\n\t*100644->100664 blob    7476bbcfe5ef5a1dd87d745f298b831143e4d77e->0000000000000000000000000000000000000000      kernel/sched.c\n\nie it shows that the tree has changed, and that \"kernel/sched.c\" has is\nnot up-to-date and may contain new stuff. The all-zero sha1 means that to\nget the real diff, you need to look at the object in the working directory\ndirectly rather than do an object-to-object diff.\n\nNOTE! As with other commands of this type, \"diff-cache\" does not actually \nlook at the contents of the file at all. So maybe \"kernel/sched.c\" hasn't \nactually changed, and it's just that you touched it. In either case, it's \na note that you need to upate-cache it to make the cache be in sync.\n\nNOTE 2! You can have a mixture of files show up as \"has been updated\" and\n\"is still dirty in the working directory\" together. You can always tell\nwhich file is in which state, since the \"has been updated\" ones show a\nvalid sha1, and the \"not in sync with the index\" ones will always have the\nspecial all-zero sha1.\n\n################################################################\ndiff-tree\n\tdiff-tree [-p] [-r] [-z] <tree/commit> <tree/commit> [<pattern>]*\n\nCompares the content and mode of the blobs found via two tree objects.\n\nNote that diff-tree can use the tree encapsulated in a commit object.\n\n<tree sha1>\n\tThe id of a tree or commit object.\n\n<pattern>\n\n\tIf provided, the results are limited to a subset of files\n\tmatching one of these prefix strings.\n\tie file matches /^<pattern1>|<pattern2>|.../\n\tNote that pattern does not provide any wildcard or regexp features.\n\n-p\n\tgenerate patch (see section on generating patches)\n\n-r\n\trecurse\n\n-z\n\t\\0 line termination on output\n\nLimiting Output\n\nIf you're only interested in differences in a subset of files, for\nexample some architecture-specific files, you might do:\n\n\tdiff-tree -r <tree/commit> <tree/commit> arch/ia64 include/asm-ia64\n\nand it will only show you what changed in those two directories.\n\nOr if you are searching for what changed in just kernel/sched.c, just do\n\n\tdiff-tree -r <tree/commit> <tree/commit> kernel/sched.c\n\nand it will ignore all differences to other files.\n\nThe pattern is always the prefix, and is matched exactly (ie there are no\nwildcards - although matching a directory, which it does support, can\nobviously be seen as a \"wildcard\" for all the files under that directory).\n\nOutput format:\n\nSee \"Output format from diff-cache, diff-tree and show-diff\" section.\n\nAn example of normal usage is:\n\n\ttorvalds@ppc970:~/git> diff-tree 5319e4d609cdd282069cc4dce33c1db559539b03 b4e628ea30d5ab3606119d2ea5caeab141d38df7\n\t*100664->100664 blob    ac348b7d5278e9d04e3a1cd417389379c32b014f->a01513ed4d4d565911a60981bfb4173311ba3688      fsck-cache.c\n\nwhich tells you that the last commit changed just one file (it's from\nthis one:\n\n\tcommit 3c6f7ca19ad4043e9e72fa94106f352897e651a8\n\ttree 5319e4d609cdd282069cc4dce33c1db559539b03\n\tparent b4e628ea30d5ab3606119d2ea5caeab141d38df7\n\tauthor Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005\n\tcommitter Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005\n\n\tMake \"fsck-cache\" print out all the root commits it finds.\n\n\tOnce I do the reference tracking, I'll also make it print out all the\n\tHEAD commits it finds, which is even more interesting.\n\nin case you care).\n\n################################################################\ndiff-tree-helper\n\tdiff-tree-helper [-z]\n\nReads output from diff-cache, diff-tree and show-diff and\ngenerates patch format output.\n\n-z\n\t\\0 line termination on input\n\nSee also the section on generating patches.\n\n################################################################\nfsck-cache\n\tfsck-cache [[--unreachable] <commit>*]\n\nVerifies the connectivity and validity of the objects in the database.\n\n<commit>\n\tA commit object to treat as the head of an unreachability\n\ttrace\n\n--unreachable\n\tprint out objects that exist but that aren't readable from any\n\tof the specified root nodes\n\nIt tests SHA1 and general object sanity, but it does full tracking of\nthe resulting reachability and everything else. It prints out any\ncorruption it finds (missing or bad objects), and if you use the\n\"--unreachable\" flag it will also print out objects that exist but\nthat aren't readable from any of the specified root nodes.\n\nSo for example\n\n\tfsck-cache --unreachable $(cat .git/HEAD)\n\nor, for Cogito users:\n\n\tfsck-cache --unreachable $(cat .git/heads/*)\n\nwill do quite a _lot_ of verification on the tree. There are a few\nextra validity tests to be added (make sure that tree objects are\nsorted properly etc), but on the whole if \"fsck-cache\" is happy, you\ndo have a valid tree.\n\nAny corrupt objects you will have to find in backups or other archives\n(ie you can just remove them and do an \"rsync\" with some other site in\nthe hopes that somebody else has the object you have corrupted).\n\nOf course, \"valid tree\" doesn't mean that it wasn't generated by some\nevil person, and the end result might be crap. Git is a revision\ntracking system, not a quality assurance system ;)\n\nExtracted Diagnostics\n\nexpect dangling commits - potential heads - due to lack of head information\n\tYou haven't specified any nodes as heads so it won't be\n\tpossible to differentiate between un-parented commits and\n\troot nodes.\n\nmissing sha1 directory '<dir>'\n\tThe directory holding the sha1 objects is missing.\n\nunreachable <type> <object>\n\tThe <type> object <object>, isn't actually referred to directly\n\tor indirectly in any of the trees or commits seen. This can\n\tmean that there's another root na SHA1_ode that you're not specifying\n\tor that the tree is corrupt. If you haven't missed a root node\n\tthen you might as well delete unreachable nodes since they\n\tcan't be used.\n\nmissing <type> <object>\n\tThe <type> object <object>, is referred to but isn't present in\n\tthe database.\n\ndangling <type> <object>\n\tThe <type> object <object>, is present in the database but never\n\t_directly_ used. A dangling commit could be a root node.\n\nwarning: fsck-cache: tree <tree> has full pathnames in it\n\tAnd it shouldn't...\n\nsha1 mismatch <object>\n\tThe database has an object who's sha1 doesn't match the\n\tdatabase value.\n\tThis indicates a ??serious?? data integrity problem.\n\t(note: this error occured during early git development when\n\tthe database format changed.)\n\nEnvironment Variables\n\nSHA1_FILE_DIRECTORY\n\tused to specify the object database root (usually .git/objects)\n\n################################################################\ngit-export\n\tgit-export top [base]\n\nprobably deprecated:\nOn Wed, 20 Apr 2005, Petr Baudis wrote:\n>> I will probably not buy git-export, though. (That is, it is merged, but\n>> I won't make git frontend for it.) My \"git export\" already does\n>> something different, but more importantly, \"git patch\" of mine already\n>> does effectively the same thing as you do, just for a single patch; so I\n>> will probably just extend it to do it for an (a,b] range of patches.\n\n\nThat's fine. It was a quick hack, just to show that if somebody wants to, \nthe data is trivially exportable.\n\n\t\tLinus\n\nAlthough in Linus' distribution, git-export is not part of 'core' git.\n\n################################################################\ninit-db\n\tinit-db\n\nThis simply creates an empty git object database - basically a .git\ndirectory.\n\nIf the object storage directory is specified via the\nSHA1_FILE_DIRECTORY environment variable then the sha1 directories are\ncreated underneath - otherwise the default .git/objects directory is\nused.\n\ninit-db won't hurt an existing repository.\n\n\n################################################################\nls-tree\n\tls-tree [-r] [-z] <tree/commit>\n\nconvert the tree object to a human readable (and script\nprocessable) form.\n\n<tree/commit>\n\tId of a tree or commit object.\n-r\n\trecurse into sub-trees\n\n-z\n\t\\0 line termination on output\n\nOutput Format\n<mode>\\t\t<type>\\t\t<object>\\t\t<path><file>\t\n\n\n################################################################\nmerge-base\n\tmerge-base <commit> <commit>\n\nmerge-base finds as good a common ancestor as possible. Given a\nselection of equally good common ancestors it should not be relied on\nto decide in any particular way.\n\nThe merge-base algorithm is still in flux - use the source...\n\n\n################################################################\nmerge-cache\n\tmerge-cache <merge-program> (-a | -- | <file>*) \n\nThis looks up the <file>(s) in the cache and, if there are any merge\nentries, unpacks all of them (which may be just one file, of course)\ninto up to three separate temporary files, and then executes the\nsupplied <merge-program> with those three files as arguments 1,2,3\n(empty argument if no file), and <file> as argument 4.\n\n--\n\tInterpret all future arguments as filenames\n\n-a\n\tRun merge against all files in the cache that need merging.\n\nIf merge-cache is called with multiple <file>s (or -a) then it\nprocesses them in turn only stopping if merge returns a non-zero exit\ncode.\n\nTypically this is run with the a script calling the merge command from\nthe RCS package.\n\nA sample script called git-merge-one-file-script is included in the\nditribution.\n\nALERT ALERT ALERT! The git \"merge object order\" is different from the\nRCS \"merge\" program merge object order. In the above ordering, the\noriginal is first. But the argument order to the 3-way merge program\n\"merge\" is to have the original in the middle. Don't ask me why.\n\nExamples:\n\n\ttorvalds@ppc970:~/merge-test> merge-cache cat MM\n\tThis is MM from the original tree.\t\t\t# original\n\tThis is modified MM in the branch A.\t\t\t# merge1\n\tThis is modified MM in the branch B.\t\t\t# merge2\n\tThis is modified MM in the branch B.\t\t\t# current contents\n\nor \n\n\ttorvalds@ppc970:~/merge-test> merge-cache cat AA MM\n\tcat: : No such file or directory\n\tThis is added AA in the branch A.\n\tThis is added AA in the branch B.\n\tThis is added AA in the branch B.\n\tfatal: merge program failed\n\nwhere the latter example shows how \"merge-cache\" will stop trying to\nmerge once anything has returned an error (ie \"cat\" returned an error\nfor the AA file, because it didn't exist in the original, and thus\n\"merge-cache\" didn't even try to merge the MM thing).\n\n\n################################################################\nread-tree\n\tread-tree (<tree/commit> | -m <tree/commit1> [<tree/commit2> <tree/commit3>])\"\n\nReads the tree information given by <tree> into the directory cache,\nbut does not actually _update_ any of the files it \"caches\". (see:\ncheckout-cache)\n\nOptionally, it can merge a tree into the cache or perform a 3-way\nmerge.\n\nTrivial merges are done by read-tree itself.  Only conflicting paths\nwill be in unmerged state when read-tree returns.\n\n-m\n\tPerform a merge, not just a read\n\n<tree#>\n\tThe id of the tree object(s) to be read/merged.\n\n\nMerging\nIf -m is specified, read-tree performs 2 kinds of merge, a single tree\nmerge if only 1 tree is given or a 3-way merge if 3 trees are\nprovided.\n\nSingle Tree Merge\nIf only 1 tree is specified, read-tree operates as if the user did not\nspecify \"-m\", except that if the original cache has an entry for a\ngiven pathname; and the contents of the path matches with the tree\nbeing read, the stat info from the cache is used. (In other words, the\ncache's stat()s take precedence over the merged tree's)\n\nThat means that if you do a \"read-tree -m <newtree>\" followed by a\n\"checkout-cache -f -a\", the checkout-cache only checks out the stuff\nthat really changed.\n\nThis is used to avoid unnecessary false hits when show-diff is\nrun after read-tree.\n\n3-Way Merge\nEach \"index\" entry has two bits worth of \"stage\" state. stage 0 is the\nnormal one, and is the only one you'd see in any kind of normal use.\n\nHowever, when you do \"read-tree\" with multiple trees, the \"stage\"\nstarts out at 0, but increments for each tree you read. And in\nparticular, the \"-m\" flag means \"start at stage 1\" instead.\n\nThis means that you can do\n\n\tread-tree -m <tree1> <tree2> <tree3>\n\nand you will end up with an index with all of the <tree1> entries in\n\"stage1\", all of the <tree2> entries in \"stage2\" and all of the\n<tree3> entries in \"stage3\".\n\nFurthermore, \"read-tree\" has special-case logic that says: if you see\na file that matches in all respects in the following states, it\n\"collapses\" back to \"stage0\":\n\n   - stage 2 and 3 are the same; take one or the other (it makes no\n     difference - the same work has been done on stage 2 and 3)\n\n   - stage 1 and stage 2 are the same and stage 3 is different; take\n     stage 3 (some work has been done on stage 3)\n\n   - stage 1 and stage 3 are the same and stage 2 is different take\n     stage 2 (some work has been done on stage 2)\n\nWrite-tree refuses to write a nonsensical tree, so write-tree will\ncomplain about unmerged entries if it sees a single entry that is not\nstage 0\".\n\nOk, this all sounds like a collection of totally nonsensical rules,\nbut it's actually exactly what you want in order to do a fast\nmerge. The different stages represent the \"result tree\" (stage 0, aka\n\"merged\"), the original tree (stage 1, aka \"orig\"), and the two trees\nyou are trying to merge (stage 2 and 3 respectively).\n\nIn fact, the way \"read-tree\" works, it's entirely agnostic about how\nyou assign the stages, and you could really assign them any which way,\nand the above is just a suggested way to do it (except since\n\"write-tree\" refuses to write anything but stage0 entries, it makes\nsense to always consider stage 0 to be the \"full merge\" state).\n\nSo what happens? Try it out. Select the original tree, and two trees\nto merge, and look how it works:\n\n - if a file exists in identical format in all three trees, it will \n   automatically collapse to \"merged\" state by the new read-tree.\n\n - a file that has _any_ difference what-so-ever in the three trees\n   will stay as separate entries in the index. It's up to \"script\n   policy\" to determine how to remove the non-0 stages, and insert a\n   merged version.  But since the index is always sorted, they're easy\n   to find: they'll be clustered together.\n\n - the index file saves and restores with all this information, so you\n   can merge things incrementally, but as long as it has entries in\n   stages 1/2/3 (ie \"unmerged entries\") you can't write the result.\n\nSo now the merge algorithm ends up being really simple:\n\n - you walk the index in order, and ignore all entries of stage 0,\n   since they've already been done.\n\n - if you find a \"stage1\", but no matching \"stage2\" or \"stage3\", you\n   know it's been removed from both trees (it only existed in the\n   original tree), and you remove that entry.  - if you find a\n   matching \"stage2\" and \"stage3\" tree, you remove one of them, and\n   turn the other into a \"stage0\" entry. Remove any matching \"stage1\"\n   entry if it exists too.  .. all the normal trivial rules ..\n\nIncidentally - it also means that you don't even have to have a separate \nsubdirectory for this. All the information literally is in the index file, \nwhich is a temporary thing anyway. There is no need to worry about what is in \nthe working directory, since it is never shown and never used.\n\nsee also:\nwrite-tree\nshow-files\n\n\n################################################################\nrev-list <commit>\n\nLists commit objects in reverse chronological order starting at the\ngiven commit, taking ancestry relationship into account.  This is\nuseful to produce human-readable log output.\n\n\n################################################################\nrev-tree\n\trev-tree [--edges] [--cache <cache-file>] [^]<commit> [[^]<commit>]\n\nProvides the revision tree for one or more commits.\n\n--edges\n\tShow edges (ie places where the marking changes between parent\n\tand child)\n\n--cache <cache-file>\n\tUse the specified file as a cache. [Not implemented yet]\n\n[^]<commit>\n\tThe commit id to trace (a leading caret means to ignore this\n\tcommit-id and below)\n\nOutput:\n<date> <commit>:<flags> [<parent-commit>:<flags> ]*\n\n<date>\n\tDate in 'seconds since epoch'\n\n<commit>\n\tid of commit object\n\n<parent-commit>\n\tid of each parent commit object (>1 indicates a merge)\n\n<flags>\n\n\tThe flags are read as a bitmask representing each commit\n\tprovided on the commandline. eg: given the command:\n\n\t\t $ rev-tree <com1> <com2> <com3>\n\n\tThe output:\n\n\t    <date> <commit>:5\n\n\t means that <commit> is reachable from <com1>(1) and <com3>(4)\n\t\nA revtree can get quite large. rev-tree will eventually allow you to\ncache previous state so that you don't have to follow the whole thing\ndown.\n\nSo the change difference between two commits is literally\n\n\trev-tree [commit-id1]  > commit1-revtree\n\trev-tree [commit-id2]  > commit2-revtree\n\tjoin -t : commit1-revtree commit2-revtree > common-revisions\n\n(this is also how to find the most common parent - you'd look at just\nthe head revisions - the ones that aren't referred to by other\nrevisions - in \"common-revision\", and figure out the best one. I\nthink.)\n\n\n################################################################\nshow-diff\n\tshow-diff [-p] [-q] [-s] [-z] [paths...]\n\nCompares the files in the working tree and the cache.  When paths\nare specified, compares only those named paths.  Otherwise all\nentries in the cache are compared.  The output format is the\nsame as diff-cache and diff-tree.\n\n-p\n\tgenerate patch (see section on generating patches)\n\n-q\n\tRemain silent even on nonexisting files\n\n-s\n\tDoes not do anything other than what -q does.\n\nOutput format:\n\nSee \"Output format from diff-cache, diff-tree and show-diff\" section.\n\n################################################################\nshow-files\n\tshow-files [-z] [-t]\n\t\t(--[cached|deleted|others|ignored|stage|unmerged])*\n\t\t(-[c|d|o|i|s|u])*\n\t\t[-x <pattern>|--exclude=<pattern>]\n\t\t[-X <file>|--exclude-from=<file>]\n\nThis merges the file listing in the directory cache index with the\nactual working directory list, and shows different combinations of the\ntwo.\n\nOne or more of the options below may be used to determine the files\nshown:\n\n-c|--cached\n\tShow cached files in the output (default)\n\n-d|--deleted\n\tShow deleted files in the output\n\n-o|--others\n\tShow other files in the output\n\n-i|--ignored\n\tShow ignored files in the output\n\tNote the this also reverses any exclude list present.\n\n-s|--stage\n\tShow stage files in the output\n\n-u|--unmerged\n\tShow unmerged files in the output (forces --stage)\n\n#-t [not in Linus' tree (yet?)]\n#\tIdentify the file status with the following tags (followed by\n#\ta space) at the start of each line:\n#\tH\tcached\n#\tM\tunmerged\n#\tR\tremoved/deleted\n#\t?\tother\n\n-z\n\t\\0 line termination on output\n\n-x|--exclude=<pattern>\n\tSkips files matching pattern.\n\tNote that pattern is a shell wildcard pattern.\n\n-X|--exclude-from=<file>\n\texclude patterns are read from <file>; 1 per line.\n\tAllows the use of the famous dontdiff file as follows to find\n\tout about uncommitted files just as dontdiff is used with\n\tthe diff command:\n\t     show-files --others --exclude-from=dontdiff\n\nOutput\nshow files just outputs the filename unless --stage is specified in\nwhich case it outputs:\n\n[<tag> ]<mode> <object> <stage> <file>\n\nshow-files --unmerged\" and \"show-files --stage \" can be used to examine\ndetailed information on unmerged paths.\n\nFor an unmerged path, instead of recording a single mode/SHA1 pair,\nthe dircache records up to three such pairs; one from tree O in stage\n1, A in stage 2, and B in stage 3.  This information can be used by\nthe user (or Cogito) to see what should eventually be recorded at the\npath. (see read-cache for more information on state)\n\nsee also:\nread-cache\n\n\n################################################################\nunpack-file\n\tunpack-file <blob>\n\nCreates a file holding the contents of the blob specified by sha1. It\nreturns the name of the temporary file in the following format:\n\t.merge_file_XXXXX\n\n<blob>\n\tMust be a blob id\n\n################################################################\nupdate-cache\n\tupdate-cache [--add] [--remove] [--refresh [--ignore-missing]]\n\t\t     [--cacheinfo <mode> <object> <path>]*\n\t\t     [--] [<file>]*\n\nModifies the index or directory cache. Each file mentioned is updated\ninto the cache and any 'unmerged' or 'needs updating' state is\ncleared.\n\nThe way update-cache handles files it is told about can be modified\nusing the various options:\n\n--add\n\tIf a specified file isn't in the cache already then it's\n\tadded.\n\tDefault behaviour is to ignore new files.\n\n--remove\n\tIf a specified file is in the cache but is missing then it's\n\tremoved.\n\tDefault behaviour is to ignore removed file.\n\n--refresh\n\tLooks at the current cache and checks to see if merges or\n\tupdates are needed by checking stat() information.\n\n--ignore-missing\n\tIgnores missing files during a --refresh\n\n--cacheinfo <mode> <object> <path>\n\tDirectly insert the specified info into the cache.\n\t\n--\n\tDo not interpret any more arguments as options.\n\n<file>\n\tFiles to act on.\n\tNote that files begining with '.' are discarded. This includes\n\t\"./file\" and \"dir/./file\". If you don't want this, then use\t\n\tcleaner names.\n\tThe same applies to directories ending '/' and paths with '//'\n\n\nUsing --refresh\n\n--refresh does not calculate a new sha1 file or bring the cache\nup-to-date for mode/content changes. But what it _does_ do is to\n\"re-match\" the stat information of a file with the cache, so that you\ncan refresh the cache for a file that hasn't been changed but where\nthe stat entry is out of date.\n\nFor example, you'd want to do this after doing a \"read-tree\", to link\nup the stat cache details with the proper files.\n\nUsing --cacheinfo\n--cacheinfo is used to register a file that is not in the current\nworking directory.  This is useful for minimum-checkout merging.\n\nTo pretend you have a file with mode and sha1 at path, say:\n\n $ update-cache --cacheinfo mode sha1 path\n\nTo update and refresh only the files already checked out:\n\n   checkout-cache -n -f -a && update-cache --ignore-missing --refresh\n\n\n################################################################\nwrite-tree\n\twrite-tree\n\nCreates a tree object using the current cache.\n\nThe cache must be merged.\n\nConceptually, write-tree sync()s the current directory cache contents\ninto a set of tree files.\nIn order to have that match what is actually in your directory right\nnow, you need to have done a \"update-cache\" phase before you did the\n\"write-tree\".\n\n\n################################################################\n\nOutput format from diff-cache, diff-tree and show-diff.\n\nThese commands all compare two sets of things; what are\ncompared are different:\n\n    diff-cache <tree/commit>\n\n        compares the <tree/commit> and the files on the filesystem.\n\n    diff-cache --cached <tree/commit>\n\n        compares the <tree/commit> and the cache.\n\n    diff-tree [-r] <tree/commit-1> <tree/commit-2> [paths...]\n\n        compares the trees named by the two arguments.\n\n    show-diff [paths...]\n\n        compares the cache and the files on the filesystem.\n\nThe following desription uses \"old\" and \"new\" to mean those\ncompared entities.\n\nFor files in old but not in new (i.e. removed):\n-<mode> \\t <type> \\t <object> \\t <path>\n\nFor files not in old but in new (i.e. added):\n+<mode> \\t <type> \\t <object> \\t <path>\n\nFor files that differ:\n*<old-mode>-><new-mode> \\t <type> \\t <old-sha1>-><new-sha1> \\t <path>\n\n<new-sha1> is shown as all 0's if new is a file on the\nfilesystem and it is out of sync with the cache.  Example:\n\n    *100644->100660 blob    5be4a414b32cf4204f889469942986d3d783da84->0000000000000000000000000000000000000000      file.c\n\n################################################################\n\nGenerating patches\n\nWhen diff-cache, diff-tree, or show-diff are run with a -p\noption, they do not produce the output described in \"Output\nformat from diff-cache, diff-tree and show-diff\" section.  It\ninstead produces a patch file.\n\nThe patch generation can be customized at two levels.  This\ncustomization also applies to diff-tree-helper.\n\n1. When the environment variable GIT_EXTERNAL_DIFF is not set,\n   these commands internally invoke diff like this:\n\n   diff -L k/<path> -L l/<path> -pu <old> <new>\n\n   For added files, /dev/null is used for <old>.  For removed\n   files, /dev/null is used for <new>\n\n   The first part of the above command-line can be customized via\n   the environment variable GIT_DIFF_CMD.  For example, if you\n   do not want to show the extra level of leading path, you can\n   say this:\n\n   GIT_DIFF_CMD=\"diff -L'%s' -L'%s'\" show-diff -p\n\n   Caution:  Do not use more than two '%s' in GIT_DIFF_CMD.\n\n   The diff formatting options can be customized via the\n   environment variable GIT_DIFF_OPTS.  For example, if you\n   prefer context diff:\n\n   GIT_DIFF_OPTS=-c diff-cache -p $(cat .git/HEAD)\n\n\n2. When the environment variable GIT_EXTERNAL_DIFF is set, the\n   program named by it is called, instead of the diff invocation\n   described above.\n\n   For a path that is added, removed, or modified,\n   GIT_EXTERNAL_DIFF is called with 7 parameters:\n\n     path old-file old-hex old-mode new-file new-hex new-mode\n\n   where\n     <old|new>-file are files GIT_EXTERNAL_DIFF can use to read the\n                    contents of <old|ne>,\n     <old|new>-hex are the 40-hexdigit SHA1 hashes,\n     <old|new>-mode are the octal representation of the file modes.\n\n   The file parameters can point at the user's working file\n   (e.g. new-file in show-diff), /dev/null (e.g. old-file when a\n   new file is added), or a temporary file (e.g. old-file in the\n   cache).  GIT_EXTERNAL_DIFF should not worry about\n   unlinking the temporary file --- it is removed when\n   GIT_EXTERNAL_DIFF exits.\n\n   For a path that is unmerged, GIT_EXTERNAL_DIFF is called with\n   1 parameter, path.\n\n################################################################\n\nTerminology: - see README for description\nEach line contains terms used interchangeably\n\nobject database, .git directory\ndirectory cache, index\nid, sha1, sha1-id, sha1 hash\ntype, tag\nblob, blob object\ntree, tree object\ncommit, commit object\nparent\nroot object\nchangeset\n\n\ngit Environment Variables\nAUTHOR_NAME\nAUTHOR_EMAIL\nAUTHOR_DATE\nCOMMIT_AUTHOR_NAME\nCOMMIT_AUTHOR_EMAIL\nGIT_DIFF_CMD\nGIT_DIFF_OPTS\nGIT_EXTERNAL_DIFF\nGIT_INDEX_FILE\nSHA1_FILE_DIRECTORY\n\n"},{"id":"2306","messageId":"7vsm16u6d4.fsf@assigned-by-dhcp.cox.net","threadId":"418","inReplyTo":"42750D06.70004@dgreaves.com","subject":"Re: Quick command reference","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-01T18:51:51Z","receivedAt":"2005-05-01T18:51:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I suspect by now my endorsement would count at least a bit, so ...\n\nDG> Please commit the version below (into a Documentation dir)\nDG> and then all I have to do is send you patches to commit and\nDG> you don't have to put too much effort into keeping it\nDG> updated. It's 'only' docs - so although I may get it wrong,\nDG> people like Junio will be sure to correct me.\n\nLinus, I'm with David on this one.  I haven't reviewed his stuff\nin this latest incarnation but I did review the draft a round\nbefore and I felt it was accurate and ready for public (meaning\nPorcelain layer writers and brave end users) consumption.\n\nDG> I chose text to start since it could easily be read on the\nDG> mailing list.  I'll gladly put it into some kind of markup\nDG> later when the features start to stabilise.  For now people\nDG> can wrap it in <pre> tags.\n\nLinus, I'm with David on this one.  Text is Good.\n\n"},{"id":"2308","messageId":"7v4qdmu4pw.fsf@assigned-by-dhcp.cox.net","threadId":"418","inReplyTo":"42750D06.70004@dgreaves.com","subject":"Re: Quick command reference","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-01T19:27:23Z","receivedAt":"2005-05-01T19:27:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"DG\" == David Greaves <david@dgreaves.com> writes:\n\nAfter I sent my endorsements, I noticed some nits so I pick them\nhere.  As you already know, you would also need to adjust to the\nbig git-* renaming.\n\nDG> \t[Eventually may be replaced with <tree> if <tree> means\nDG> \t<tree/commit> in all commands]\n\nProbably not.  I think commit-tree should insist on its first\nparameter being a tree not a commit for example, so I would drop\nthis comment.\n\nAlso tags are included in tree/commit class for some but\nprobably not all commands these days.  How about coming up with\na short-and-sweet name like <tree-id> and use it instead of\n<tree/commit>?  You would need <commit-id> as well because tags\ncan be auto-dereferenced to commits by certain commands.\n\nDG> <type>\nDG> \tIndicates that an object type is required.\nDG> \tCurrently one of: blob/tree/commit\n\nThat's:\n\n\tCurrently one of: blob/commit/tag/tree\n\nDG> <file>\nDG> \tIndicates a filename - often includes leading path\nDG> <path>\nDG> \tIndicates the path of a file (is this ever useful?)\n\nI do not know what you wanted to distinguish by having separate\n<file> and <path>.  There is only one thing.\n\nWe may want to mention that Core GIT expects the commands to run\nfrom the directory that corresponds to the root level of the\ntree structure GIT_INDEX_FILE describes, and the path/file\n(whichever name you pick) are expected to be relative to that\ndirectory.  No absolute paths, no ./relative paths with leading\ndot-slash.\n\nDG> ################################################################\nDG> cat-file\nDG> \tcat-file (-t | <type>) <object>\nDG> ...\nDG> <type>\nDG> \tOne of: blob/tree/commit\nDG> ...\nDG> Output\nDG> If -t is specified, one of:\nDG>         blob/tree/commit\n\nLet's not list the type but refer the reader to the top part of\nthe document that lists the type.\n\nDG> ################################################################\nDG> checkout-cache\nDG> ... Note that the file contents are\nDG> restored - NOT the file permissions.\nDG> ??? l 58 checkout-cache.c says restore executable bit.\n\nSo which is correct?\n\nDG> ################################################################\nDG> diff-tree-helper\nDG> \tdiff-tree-helper [-z]\n\nUpdate:\n\tdiff-tree-helper [-z] [-R]\n\nAdd:\n        -R\tgenerate the patch in reverse.\n\nDG> ################################################################\nDG> fsck-cache\nDG> \tfsck-cache [[--unreachable] <commit>*]\n\n--root?\n\nDG> ################################################################\nDG> show-diff\nDG> \tshow-diff [-p] [-q] [-s] [-z] [paths...]\n\nAfter big git-* rename this became git-diff-files; just to keep\nan eye on when you do the updates.\n\nDG> ################################################################\nDG> show-files\n\nAnd this one is now git-ls-files.\n\nDG> ################################################################\nDG> unpack-file\nDG> \tunpack-file <blob>\n\nAdd:\n\n    Note that the temporary file is created with mkstemp(3) and it\n    would have permission 0600 or 0666 depending on your glibc\n    version.  Make sure to fix the permission if you use this in\n    your script.\n\nDG> ################################################################\nDG> Generating patches\n\nPlease drop the following part.  GIT_DIFF_CMD is not supported\nanymore:\n\nDG>    The first part of the above command-line can be customized via\nDG>    the environment variable GIT_DIFF_CMD...\nDG>    ... \nDG>    Caution:  Do not use more than two '%s' in GIT_DIFF_CMD.\n\nDrop it also from \"git Environment Variables\" section.\n\n"},{"id":"2312","messageId":"427537C6.9070806@zytor.com","threadId":"418","inReplyTo":"4274F373.6030001@khandalf.com","subject":"Re: Quick command reference","fromName":"H. Peter Anvin","fromEmail":"hpa@zytor.com","sentAt":"2005-05-01T20:10:46Z","receivedAt":"2005-05-01T20:10:46Z","isPatch":false,"sender":{"key":"hpa@zytor.com","avatar":null},"body":"Brian O'Mahoney wrote:\n> Thank you both for taking the time and trouble to do this, particularly\n> with the name changes and new options; why don't you merge your efforts\n> and produce a GIT-Mini-HOWTO BTW send it off as a patch again!\n\nEven better... man page(s)!\n\n\t-hpa\n"},{"id":"2315","messageId":"42753CAC.7060900@dgreaves.com","threadId":"418","inReplyTo":"427537C6.9070806@zytor.com","subject":"Re: Quick command reference","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-05-01T20:31:40Z","receivedAt":"2005-05-01T20:31:40Z","isPatch":false,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"H. Peter Anvin wrote:\n\n> Brian O'Mahoney wrote:\n>\n>> Thank you both for taking the time and trouble to do this, particularly\n>> with the name changes and new options; why don't you merge your efforts\n>> and produce a GIT-Mini-HOWTO BTW send it off as a patch again!\n>\n>\n> Even better... man page(s)!\n\nOf course.\n\nEventually.\n\nBut I'd probably get limited reviewers if I posted nroff to the list...\n(probably more than if I included html in my emails though)\n\n:)\n\nNice to see there's a lot of support for and interest in getting the\ndocs though.\n[Hmm, making statements like that with Linus on the cc - I could be in\npolitics ;) ]\n\nDavid\n\n"},{"id":"2323","messageId":"20050501211808.GA6900@outpost.ds9a.nl","threadId":"418","inReplyTo":"Pine.LNX.4.58.0505010927040.2296@ppc970.osdl.org","subject":"Re: Quick command reference","fromName":"bert hubert","fromEmail":"ahu@ds9a.nl","sentAt":"2005-05-01T21:18:08Z","receivedAt":"2005-05-01T21:18:08Z","isPatch":false,"sender":{"key":"ahu@ds9a.nl","avatar":null},"body":"On Sun, May 01, 2005 at 09:29:23AM -0700, Linus Torvalds wrote:\n> (And no, by \"standard format\" I do _not_ mean xml or stuff like that. I \n> mean something that is actually easy to read ;)\n\nI've recently been very happy with AsciiDoc\nhttp://www.methods.co.nz/asciidoc/ - it's input is as easy to read as to\nwrite.\n\n>From this input:\nhttp://ds9a.nl/splitpipe/splitpipe-0.3/doc/splitpipe.1.txt\n\nIt produces this lovely page (html, man, pdf, the works):\nhttp://ds9a.nl/splitpipe/splitpipe-0.3/doc/splitpipe.1.html\n\nAnd if you are really in a wild mood, you can have it make entire websites,\nlike http://ds9a.nl/splitpipe\n\nWhen used properly it builds tables of contents, indexes, books and whatnot.\n\n-- \nhttp://www.PowerDNS.com      Open source, database driven DNS Software \nhttp://netherlabs.nl              Open and Closed source services\n"},{"id":"2330","messageId":"4275540F.1010200@dgreaves.com","threadId":"418","inReplyTo":"20050501211808.GA6900@outpost.ds9a.nl","subject":"Re: Quick command reference","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-05-01T22:11:27Z","receivedAt":"2005-05-01T22:11:27Z","isPatch":false,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"bert hubert wrote:\n\n>I've recently been very happy with AsciiDoc\n>http://www.methods.co.nz/asciidoc/ - it's input is as easy to read as to\n>write.\n>  \n>\nsold\n\n"},{"id":"2331","messageId":"Pine.LNX.4.58.0505011543220.2296@ppc970.osdl.org","threadId":"418","inReplyTo":"20050501211808.GA6900@outpost.ds9a.nl","subject":"Re: Quick command reference","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-05-01T22:45:25Z","receivedAt":"2005-05-01T22:45:25Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 1 May 2005, bert hubert wrote:\n> \n> I've recently been very happy with AsciiDoc\n> http://www.methods.co.nz/asciidoc/ - it's input is as easy to read as to\n> write.\n\nI have to agree. I don't much like most markup languages, but this one \nactually seems to truly _be_ readable even in its plain source format.\n\n\t\tLinus\n"},{"id":"2337","messageId":"20050501170917.4a8f3756.rddunlap@osdl.org","threadId":"418","inReplyTo":"20050501211808.GA6900@outpost.ds9a.nl","subject":"Re: Quick command reference","fromName":"Randy.Dunlap","fromEmail":"rddunlap@osdl.org","sentAt":"2005-05-02T00:09:17Z","receivedAt":"2005-05-02T00:09:17Z","isPatch":false,"sender":{"key":"rddunlap@osdl.org","avatar":null},"body":"On Sun, 1 May 2005 23:18:08 +0200 bert hubert wrote:\n\n| On Sun, May 01, 2005 at 09:29:23AM -0700, Linus Torvalds wrote:\n| > (And no, by \"standard format\" I do _not_ mean xml or stuff like that. I \n| > mean something that is actually easy to read ;)\n| \n| I've recently been very happy with AsciiDoc\n| http://www.methods.co.nz/asciidoc/ - it's input is as easy to read as to\n| write.\n| \n| >From this input:\n| http://ds9a.nl/splitpipe/splitpipe-0.3/doc/splitpipe.1.txt\n| \n| It produces this lovely page (html, man, pdf, the works):\n| http://ds9a.nl/splitpipe/splitpipe-0.3/doc/splitpipe.1.html\n| \n| And if you are really in a wild mood, you can have it make entire websites,\n| like http://ds9a.nl/splitpipe\n| \n| When used properly it builds tables of contents, indexes, books and whatnot.\n\nAsciiDoc is already agreed upon, but here's another one that\nI have used:  Markdown:\n  http://daringfireball.net/projects/markdown/\n\n---\n~Randy\n"},{"id":"2653","messageId":"7vhdhgeuj1.fsf@assigned-by-dhcp.cox.net","threadId":"418","inReplyTo":"42750D06.70004@dgreaves.com","subject":"Quick command reference","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-06T06:30:10Z","receivedAt":"2005-05-06T06:30:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus, please pull from git-jc.git archive at:\n\n    http://members.cox.net/junkio/git-jc.git/\n\n(this time I have refs/heads/master there as well as HEAD; sorry\nbut no rsync).\n\nI've added the Documentation directory as you suggested and\nplaced the copy of Quick reference David Greaves has been\nworking on.  I've minimally copy edited it to match the current\ncommand names after the big git-* renaming, and also added\ndescriptions of commands and scripts that was missing back\nthen.  These three steps are recorded as separate commits (in\nsequence, not Octopus).\n\nThe format is still plain text.  AsciiDoc can come in the next\nround, but let's get the ball rolling by putting something in\nthere.\n\nPlease note that I do not intend to take the document over from\nDavid.  I am just trying to help him get the result of his\neffort into the mainline so that the document helps wider\naudience, and to encourage (and remind) patch writers to keep it\nup to date when modifying the Plumbing.\n\n"},{"id":"2656","messageId":"7v3bt0em35.fsf_-_@assigned-by-dhcp.cox.net","threadId":"418","inReplyTo":"7vhdhgeuj1.fsf@assigned-by-dhcp.cox.net","subject":"GIT blame (was Re: Quick command reference)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-05-06T09:32:30Z","receivedAt":"2005-05-06T09:32:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> I == Junio C Hamano <junkio@cox.net> said:\n\nJCH> Linus, please pull from git-jc.git archive at:\nJCH>     http://members.cox.net/junkio/git-jc.git/\n\nSince that message I have added a couple more commits there.\nOne of the things is a backport of -t (tag) flag to git-ls-files\nfrom Cogito fork.\n\nThe reason I am writing this message is not because I am excited\nabout the backport [*1*], but because I find it quite cool the\nway I found out which commit in Pasky's development line\nintroduced the change.  It demonstrates your previous \"renames\ndoes not matter when doing CVS blame\" argument actually works.\n\nHere is what I did:\n\n  1. Go into git.pasky and look at ls-files.c, grab a couple of\n     lines that look particular to Cogito version and store\n     those lines in a file.  I used the following:\n\n     $ cat >pattern <<\\EOF\n     static const char *tag_cached = \"\";\n     static const char *tag_unmerged = \"\";\n     static const char *tag_removed = \"\";\n     static const char *tag_other = \"\";\n     EOF\n\n  2. Run the following command:\n\n     $ jit-search-change HEAD pattern\n\nWhat jit-search-change does is essentially what you described in\nyour \"renames do not matter\" argument.  It does git-rev-list to\nlist the commits from newer to older, runs git-diff-tree between\nparent-commit pairs, with GIT_EXTERNAL_DIFF set to a script that\nshows the diff between corresponding file in these two trees\nonly if the file from one tree has that pattern string and the\nother tree's does not.  When it shows this diff, it also reports\nthe commit pair, and that's how you can find out which commit\nintroduced that change.\n\nIt currently shows useless hits when it sees merges from you to\nCogito, since those merges re-introduces the same change by\nforward porting it over and over, which I am thinking about ways\nto cull.  Maybe limiting the search only to parent-commit pair\nthat has only one parent would be good enough.  There are other\nthings to improve, but I am reasonably happy how it worked out.\n\n[Footnote]\n\n*1* The reason for the backport is because it is so small and\ntrivial change that does not affect the operation of the command\nwhen the flag is not used.  I do not see a reason to force Pasky\nto keep shipping the version modified for Cogito use.\n\n"}]}