Merge branch 'maint-1.6.0' into maint-1.6.1
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 Apr 2009 05:51:14 +0000 (22:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Apr 2009 05:51:14 +0000 (22:51 -0700)
* maint-1.6.0:
Documentation: clarify .gitattributes search
git-checkout.txt: clarify that <branch> applies when no path is given.
git-checkout.txt: fix incorrect statement about HEAD and index

1  2 
Documentation/git-checkout.txt
Documentation/gitattributes.txt
index 9cd51514dbfd987db4423e254e8bab7284352525,19510de151e60c2fad3715d74f9eef89cef9ad0b..5ece6cc8053d883b3f47a41c4b87ab2d46248267
@@@ -8,8 -8,8 +8,8 @@@ git-checkout - Checkout a branch or pat
  SYNOPSIS
  --------
  [verse]
 -'git checkout' [-q] [-f] [[--track | --no-track] -b <new_branch> [-l]] [-m] [<branch>]
 -'git checkout' [<tree-ish>] [--] <paths>...
 +'git checkout' [-q] [-f] [--track | --no-track] [-b <new_branch> [-l]] [-m] [<branch>]
 +'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
  
  DESCRIPTION
  -----------
@@@ -21,26 -21,16 +21,26 @@@ specified, <new_branch>.  Using -b wil
  be created; in this case you can use the --track or --no-track
  options, which will be passed to `git branch`.
  
 +As a convenience, --track will default to create a branch whose
 +name is constructed from the specified branch name by stripping
 +the first namespace level.
 +
  When <paths> are given, this command does *not* switch
  branches.  It updates the named paths in the working tree from
 -the index file (i.e. it runs `git checkout-index -f -u`), or
 -from a named commit.  In
 -this case, the `-f` and `-b` options are meaningless and giving
 +the index file, or from a named <tree-ish> (most often a commit).  In
 +this case, the `-b` options is meaningless and giving
  either of them results in an error.  <tree-ish> argument can be
  used to specify a specific tree-ish (i.e. commit, tag or tree)
  to update the index for the given paths before updating the
  working tree.
  
 +The index may contain unmerged entries after a failed merge.  By
 +default, if you try to check out such an entry from the index, the
 +checkout operation will fail and nothing will be checked out.
 +Using -f will ignore these unmerged entries.  The contents from a
 +specific side of the merge can be checked out of the index by
 +using --ours or --theirs.  With -m, changes made to the working tree
 +file can be discarded to recreate the original conflicted merge result.
  
  OPTIONS
  -------
        Quiet, suppress feedback messages.
  
  -f::
 -      Proceed even if the index or the working tree differs
 -      from HEAD.  This is used to throw away local changes.
 +      When switching branches, proceed even if the index or the
 +      working tree differs from HEAD.  This is used to throw away
 +      local changes.
 ++
 +When checking out paths from the index, do not fail upon unmerged
 +entries; instead, unmerged entries are ignored.
 +
 +--ours::
 +--theirs::
 +      When checking out paths from the index, check out stage #2
 +      ('ours') or #3 ('theirs') for unmerged paths.
  
  -b::
        Create a new branch named <new_branch> and start it at
        'git-checkout' and 'git-branch' to always behave as if '--no-track' were
        given. Set it to `always` if you want this behavior when the
        start-point is either a local or remote branch.
 ++
 +If no '-b' option was given, the name of the new branch will be
 +derived from the remote branch, by attempting to guess the name
 +of the branch on remote system.  If "remotes/" or "refs/remotes/"
 +are prefixed, it is stripped away, and then the part up to the
 +next slash (which would be the nickname of the remote) is removed.
 +This would tell us to use "hack" as the local branch when branching
 +off of "origin/hack" (or "remotes/origin/hack", or even
 +"refs/remotes/origin/hack").  If the given name has no slash, or the above
 +guessing results in an empty name, the guessing is aborted.  You can
 +explicitly give a name with '-b' in such a case.
  
  --no-track::
        Ignore the branch.autosetupmerge configuration variable.
@@@ -99,9 -69,7 +99,9 @@@
        based sha1 expressions such as "<branchname>@\{yesterday}".
  
  -m::
 -      If you have local modifications to one or more files that
 +--merge::
 +      When switching branches,
 +      if you have local modifications to one or more files that
        are different between the current branch and the branch to
        which you are switching, the command refuses to switch
        branches in order to preserve your modifications in context.
@@@ -113,23 -81,17 +113,27 @@@ When a merge conflict happens, the inde
  paths are left unmerged, and you need to resolve the conflicts
  and mark the resolved paths with `git add` (or `git rm` if the merge
  should result in deletion of the path).
 ++
 +When checking out paths from the index, this option lets you recreate
 +the conflicted merge in the specified paths.
 +
 +--conflict=<style>::
 +      The same as --merge option above, but changes the way the
 +      conflicting hunks are presented, overriding the
 +      merge.conflictstyle configuration variable.  Possible values are
 +      "merge" (default) and "diff3" (in addition to what is shown by
 +      "merge" style, shows the original contents).
  
  <new_branch>::
        Name for the new branch.
  
+ <tree-ish>::
+       Tree to checkout from (when paths are given). If not specified,
+       the index will be used.
  <branch>::
-       Branch to checkout; may be any object ID that resolves to a
-       commit.  Defaults to HEAD.
+       Branch to checkout (when no paths are given); may be any object
+       ID that resolves to a commit.  Defaults to HEAD.
  +
  When this parameter names a non-branch (but still a valid commit object),
  your HEAD becomes 'detached'.
@@@ -187,8 -149,8 +191,8 @@@ $ git checkout hello.c            <3
  ------------
  +
  <1> switch branch
- <2> take out a file out of other commit
- <3> restore hello.c from HEAD of current branch
+ <2> take a file out of another commit
+ <3> restore hello.c from the index
  +
  If you have an unfortunate branch that is named `hello.c`, this
  step would be confused as an instruction to switch to that branch.
@@@ -232,6 -194,7 +236,6 @@@ the `-m` option, you would see somethin
  ------------
  $ git checkout -m mytopic
  Auto-merging frotz
 -merge: warning: conflicts during merge
  ERROR: Merge conflict in frotz
  fatal: merge program failed
  ------------
index 8af22eccac85492416d36259baa60594c9b8382f,c4aebc4351a125ceaa92a8021f54a9849c56d03e..82c10fa0fda58a07ffd05685de4b110f38e4edad
@@@ -59,9 -59,9 +59,9 @@@ attribute
  When deciding what attributes are assigned to a path, git
  consults `$GIT_DIR/info/attributes` file (which has the highest
  precedence), `.gitattributes` file in the same directory as the
- path in question, and its parent directories (the further the
- directory that contains `.gitattributes` is from the path in
- question, the lower its precedence).
+ path in question, and its parent directories up to the toplevel of the
+ work tree (the further the directory that contains `.gitattributes`
is from the path in question, the lower its precedence).
  
  If you wish to affect only a single repository (i.e., to assign
  attributes to files that are particular to one user's workflow), then
@@@ -216,12 -216,10 +216,12 @@@ Generating diff tex
  `diff`
  ^^^^^^
  
 -The attribute `diff` affects if 'git-diff' generates textual
 -patch for the path or just says `Binary files differ`.  It also
 -can affect what line is shown on the hunk header `@@ -k,l +n,m @@`
 -line.
 +The attribute `diff` affects how 'git' generates diffs for particular
 +files. It can tell git whether to generate a textual patch for the path
 +or to treat the path as a binary file.  It can also affect what line is
 +shown on the hunk header `@@ -k,l +n,m @@` line, tell git to use an
 +external command to generate the diff, or ask git to convert binary
 +files to a text format before generating the diff.
  
  Set::
  
  Unset::
  
        A path to which the `diff` attribute is unset will
 -      generate `Binary files differ`.
 +      generate `Binary files differ` (or a binary patch, if
 +      binary patches are enabled).
  
  Unspecified::
  
  
  String::
  
 -      Diff is shown using the specified custom diff driver.
 -      The driver program is given its input using the same
 -      calling convention as used for GIT_EXTERNAL_DIFF
 -      program.  This name is also used for custom hunk header
 -      selection.
 +      Diff is shown using the specified diff driver.  Each driver may
 +      specify one or more options, as described in the following
 +      section. The options for the diff driver "foo" are defined
 +      by the configuration variables in the "diff.foo" section of the
 +      git config file.
  
  
 -Defining a custom diff driver
 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 +Defining an external diff driver
 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
  The definition of a diff driver is done in `gitconfig`, not
  `gitattributes` file, so strictly speaking this manual page is a
  wrong place to talk about it.  However...
  
 -To define a custom diff driver `jcdiff`, add a section to your
 +To define an external diff driver `jcdiff`, add a section to your
  `$GIT_DIR/config` file (or `$HOME/.gitconfig` file) like this:
  
  ----------------------------------------------------------------
@@@ -317,60 -314,15 +317,60 @@@ patterns are available
  
  - `bibtex` suitable for files with BibTeX coded references.
  
 +- `html` suitable for HTML/XHTML documents.
 +
  - `java` suitable for source code in the Java language.
  
 +- `objc` suitable for source code in the Objective-C language.
 +
  - `pascal` suitable for source code in the Pascal/Delphi language.
  
 +- `php` suitable for source code in the PHP language.
 +
 +- `python` suitable for source code in the Python language.
 +
  - `ruby` suitable for source code in the Ruby language.
  
  - `tex` suitable for source code for LaTeX documents.
  
  
 +Performing text diffs of binary files
 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 +
 +Sometimes it is desirable to see the diff of a text-converted
 +version of some binary files. For example, a word processor
 +document can be converted to an ASCII text representation, and
 +the diff of the text shown. Even though this conversion loses
 +some information, the resulting diff is useful for human
 +viewing (but cannot be applied directly).
 +
 +The `textconv` config option is used to define a program for
 +performing such a conversion. The program should take a single
 +argument, the name of a file to convert, and produce the
 +resulting text on stdout.
 +
 +For example, to show the diff of the exif information of a
 +file instead of the binary information (assuming you have the
 +exif tool installed):
 +
 +------------------------
 +[diff "jpg"]
 +      textconv = exif
 +------------------------
 +
 +NOTE: The text conversion is generally a one-way conversion;
 +in this example, we lose the actual image contents and focus
 +just on the text data. This means that diffs generated by
 +textconv are _not_ suitable for applying. For this reason,
 +only `git diff` and the `git log` family of commands (i.e.,
 +log, whatchanged, show) will perform text conversion. `git
 +format-patch` will never generate this output. If you want to
 +send somebody a text-converted diff of a binary file (e.g.,
 +because it quickly conveys the changes you have made), you
 +should generate it separately and send it as a comment _in
 +addition to_ the usual binary diff that you might send.
 +
 +
  Performing a three-way merge
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
@@@ -535,23 -487,6 +535,23 @@@ in the file.  E.g. the string `$Format:
  commit hash.
  
  
 +Viewing files in GUI tools
 +~~~~~~~~~~~~~~~~~~~~~~~~~~
 +
 +`encoding`
 +^^^^^^^^^^
 +
 +The value of this attribute specifies the character encoding that should
 +be used by GUI tools (e.g. linkgit:gitk[1] and linkgit:git-gui[1]) to
 +display the contents of the relevant file. Note that due to performance
 +considerations linkgit:gitk[1] does not use this attribute unless you
 +manually enable per-file encodings in its options.
 +
 +If this attribute is not set or has an invalid value, the value of the
 +`gui.encoding` configuration variable is used instead
 +(See linkgit:git-config[1]).
 +
 +
  USING ATTRIBUTE MACROS
  ----------------------