From 74e8a2d5f3bf4da5598f5a78350efadaddb810b8 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 13 Jan 2006 19:58:41 -0800 Subject: [PATCH] Autogenerated HTML docs for v1.1.2-g9e9b --- git-checkout.html | 84 ++++++++++++++++++++++++++++++++++++++++++++++++---- git-checkout.txt | 76 ++++++++++++++++++++++++++++++++++++++++++----- git-commit.html | 6 ++-- git-commit.txt | 4 ++- git-fetch.html | 8 ++--- git-pull.html | 8 ++--- git-push.html | 8 ++--- git-reset.html | 30 ++++++++++++++++++- git-reset.txt | 27 ++++++++++++++++- pull-fetch-param.txt | 6 ++-- 10 files changed, 225 insertions(+), 32 deletions(-) diff --git a/git-checkout.html b/git-checkout.html index 5c06d7ab..6aeac75e 100644 --- a/git-checkout.html +++ b/git-checkout.html @@ -272,7 +272,7 @@ git-checkout(1) Manual Page

SYNOPSIS

-

git-checkout [-f] [-b <new_branch>] [<branch>] [<paths>…]

+

git-checkout [-f] [-b <new_branch>] [-m] [<branch>] [<paths>…]

DESCRIPTION

@@ -308,6 +308,23 @@ given paths before updating the working tree.

+-m +
+
+

+ If you have local modifications to a file that is + different between the current branch and the branch you + are switching to, the command refuses to switch + branches, to preserve your modifications in context. + With this option, a three-way merge between the current + branch, your working tree contents, and the new branch + is done, and you will be on the new branch. +

+

When a merge conflict happens, the index entries for conflicting +paths are left unmerged, and you need to resolve the conflicts +and mark the resolved paths with git update-index.

+
+
<new_branch>
@@ -326,11 +343,15 @@ given paths before updating the working tree.

-

EXAMPLE

+

EXAMPLES

-

The following sequence checks out the master branch, reverts +

    +
  1. +

    +The following sequence checks out the master branch, reverts the Makefile to two revisions back, deletes hello.c by -mistake, and gets it back from the index.

    +mistake, and gets it back from the index. +

    $ git checkout master (1)
    @@ -349,6 +370,59 @@ that branch.  You should instead write:

    $ git checkout -- hello.c
    +
  2. +
  3. +

    +After working in a wrong branch, switching to the correct +branch you would want to is done with: +

    +
    +
    +
    $ git checkout mytopic
    +
    +

    However, your "wrong" branch and correct "mytopic" branch may +differ in files that you have locally modified, in which case, +the above checkout would fail like this:

    +
    +
    +
    $ git checkout mytopic
    +fatal: Entry 'frotz' not uptodate. Cannot merge.
    +
    +

    You can give the -m flag to the command, which would try a +three-way merge:

    +
    +
    +
    $ git checkout -m mytopic
    +Auto-merging frotz
    +
    +

    After this three-way merge, the local modifications are _not_ +registered in your index file, so git diff would show you what +changes you made since the tip of the new branch.

    +
  4. +
  5. +

    +When a merge conflict happens during switching branches with +the -m option, you would see something like this: +

    +
    +
    +
    $ git checkout -m mytopic
    +Auto-merging frotz
    +merge: warning: conflicts during merge
    +ERROR: Merge conflict in frotz
    +fatal: merge program failed
    +
    +

    At this point, git diff shows the changes cleanly merged as in +the previous example, as well as the changes in the conflicted +files. Edit and resolve the conflict and mark it resolved with +git update-index as usual:

    +
    +
    +
    $ edit frotz
    +$ git update-index frotz
    +
    +
  6. +

Author

@@ -364,7 +438,7 @@ that branch. You should instead write:

diff --git a/git-checkout.txt b/git-checkout.txt index 9442c66b..df9a6186 100644 --- a/git-checkout.txt +++ b/git-checkout.txt @@ -7,7 +7,7 @@ git-checkout - Checkout and switch to a branch. SYNOPSIS -------- -'git-checkout' [-f] [-b ] [] [...] +'git-checkout' [-f] [-b ] [-m] [] [...] DESCRIPTION ----------- @@ -34,6 +34,19 @@ OPTIONS -b:: Create a new branch and start it at . +-m:: + If you have local modifications to a file that is + different between the current branch and the branch you + are switching to, the command refuses to switch + branches, to preserve your modifications in context. + With this option, a three-way merge between the current + branch, your working tree contents, and the new branch + is done, and you will be on the new branch. ++ +When a merge conflict happens, the index entries for conflicting +paths are left unmerged, and you need to resolve the conflicts +and mark the resolved paths with `git update-index`. + :: Name for the new branch. @@ -42,13 +55,13 @@ OPTIONS commit. Defaults to HEAD. -EXAMPLE -------- +EXAMPLES +-------- -The following sequence checks out the `master` branch, reverts +. The following sequence checks out the `master` branch, reverts the `Makefile` to two revisions back, deletes hello.c by mistake, and gets it back from the index. - ++ ------------ $ git checkout master <1> $ git checkout master~2 Makefile <2> @@ -59,15 +72,64 @@ $ git checkout hello.c <3> <2> take out a file out of other commit <3> or "git checkout -- hello.c", as in the next example. ------------ - ++ If you have an unfortunate branch that is named `hello.c`, the last step above would be confused as an instruction to switch to that branch. You should instead write: - ++ ------------ $ git checkout -- hello.c ------------ +. After working in a wrong branch, switching to the correct +branch you would want to is done with: ++ +------------ +$ git checkout mytopic +------------ ++ +However, your "wrong" branch and correct "mytopic" branch may +differ in files that you have locally modified, in which case, +the above checkout would fail like this: ++ +------------ +$ git checkout mytopic +fatal: Entry 'frotz' not uptodate. Cannot merge. +------------ ++ +You can give the `-m` flag to the command, which would try a +three-way merge: ++ +------------ +$ git checkout -m mytopic +Auto-merging frotz +------------ ++ +After this three-way merge, the local modifications are _not_ +registered in your index file, so `git diff` would show you what +changes you made since the tip of the new branch. + +. When a merge conflict happens during switching branches with +the `-m` option, you would see something like this: ++ +------------ +$ git checkout -m mytopic +Auto-merging frotz +merge: warning: conflicts during merge +ERROR: Merge conflict in frotz +fatal: merge program failed +------------ ++ +At this point, `git diff` shows the changes cleanly merged as in +the previous example, as well as the changes in the conflicted +files. Edit and resolve the conflict and mark it resolved with +`git update-index` as usual: ++ +------------ +$ edit frotz +$ git update-index frotz +------------ + Author ------ diff --git a/git-commit.html b/git-commit.html index fb9532e8..01c69600 100644 --- a/git-commit.html +++ b/git-commit.html @@ -294,7 +294,9 @@ information.

- Update all paths in the index file. + Update all paths in the index file. This flag notices + files that have been modified and deleted, but new files + you have not told about git are not affected.

@@ -397,7 +399,7 @@ Junio C Hamano <junkio@cox.net>

diff --git a/git-commit.txt b/git-commit.txt index e0ff74f6..e35984df 100644 --- a/git-commit.txt +++ b/git-commit.txt @@ -25,7 +25,9 @@ information. OPTIONS ------- -a|--all:: - Update all paths in the index file. + Update all paths in the index file. This flag notices + files that have been modified and deleted, but new files + you have not told about git are not affected. -c or -C :: Take existing commit object, and reuse the log message diff --git a/git-fetch.html b/git-fetch.html index 0a6ef975..da606d45 100644 --- a/git-fetch.html +++ b/git-fetch.html @@ -563,9 +563,9 @@ is often useful.