Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] user-manual: Document that "git merge" doesn't like uncommited changes.
Date: Fri, 20 Nov 2009 12:19:40 -0800	[thread overview]
Message-ID: <7vk4xlvtib.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1258732767-12741-3-git-send-email-Matthieu.Moy@imag.fr> (Matthieu Moy's message of "Fri\, 20 Nov 2009 16\:59\:27 +0100")

Matthieu Moy <Matthieu.Moy@imag.fr> writes:

> We explain the user why uncommited changes can be problematic with merge,
> and point to "commit" and "stash" for the solution.

It is a shame that our existing documentation did not address this, and
the patch certainly takes us in the right direction.

I haven't seen a clear description of distinction between two vastly
different modes of failure from "git merge"---one that stops before even
touching anything, and one that results in conflicts to be resolved---and
how to tell them apart.  As the course of action after these two modes are
quite different, it helps users to teach it early.

I attempted to summarize it some time ago:

    http://gitster.livejournal.com/25801.html
    (Completing a merge)

    http://gitster.livejournal.com/29060.html
    (Fun with keeping local changes around)

I am not very satisfied with them, but it might be a good start.

>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
>  Documentation/user-manual.txt |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
> index 269ec47..6b4a037 100644
> --- a/Documentation/user-manual.txt
> +++ b/Documentation/user-manual.txt
> @@ -1176,14 +1176,22 @@ How to merge
>  ------------
>  
>  You can rejoin two diverging branches of development using
> -linkgit:git-merge[1]:
> +linkgit:git-merge[1].
>  
>  -------------------------------------------------
>  $ git merge branchname
>  -------------------------------------------------
>  
>  merges the development in the branch "branchname" into the current
> -branch.  If there are conflicts--for example, if the same file is
> +branch.  Note that Git merges committed changes, but not the working
> +tree itself.  Therefore, if you have uncommitted changes touching the
> +same files as the ones impacted by the merge, Git will refuse to
> +proceed.

"but not the working tree itself" is not incorrect per-se, but misses the
point.  How about...

	A merge is made by combining the changes made in "branchname" and
        the changes made up to the latest commit in your current branch
        since their histories forke.  The work tree is overwritten by the
        result of the merge when this combining is done cleanly, or
        overwritten by a half-merged results when this combining results
        in conflicts.  Therefore, ...

> +proceed.  Most of the time, you will want to commit your changes before
> +you can merge, and if you don't, then linkgit:git-stash[1] can take
> +these changes away while you're doing the merge, and reapply them
> +afterwards.
> +
> +If there are conflicts--for example, if the same file is
>  modified in two different ways in the remote branch and the local
>  branch--then you are warned; the output may look something like this:
>  
> @@ -1679,7 +1687,7 @@ Sharing development with others
>  Getting updates with git pull
>  -----------------------------
>  
> -After you clone a repository and make a few changes of your own, you
> +After you clone a repository and commit a few changes of your own, you
>  may wish to check the original repository for updates and merge them
>  into your own work.
>  
> -- 
> 1.6.5.3.435.g5f2e3.dirty

  reply	other threads:[~2009-11-20 20:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-20 15:59 [RFC/PATCH 0/2] Explain newbies the "commit before pull" flow Matthieu Moy
2009-11-20 15:59 ` [PATCH 1/2] merge-recursive: point the user to commit when file would be overwritten Matthieu Moy
2009-11-20 18:05   ` Junio C Hamano
2009-11-22 22:09     ` Matthieu Moy
2009-11-20 15:59 ` [PATCH 2/2] user-manual: Document that "git merge" doesn't like uncommited changes Matthieu Moy
2009-11-20 20:19   ` Junio C Hamano [this message]
2009-11-22 22:18     ` Matthieu Moy
2009-11-22 23:57       ` Junio C Hamano
2009-11-23  7:51         ` Matthieu Moy
2009-11-22 22:26 ` [PATCH 1/2 v2] merge-recursive: point the user to commit when file would be overwritten Matthieu Moy
2009-11-22 22:26 ` [PATCH 2/2 v2] user-manual: Document that "git merge" doesn't like uncommited changes Matthieu Moy
2009-11-23  0:08   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vk4xlvtib.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@imag.fr \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox