From: Sergey Organov <redacted>
Sergey Organov (6):
git-merge: clarify "usage" by adding "-m <msg>"
Documentation/git-merge.txt: remove list of options from SYNOPSIS
Documentation/git-merge.txt: fix SYNOPSIS of obsolete form to include
options
Documentation/git-merge.txt: improve short description in NAME
Documentation/git-merge.txt: improve short description in DESCRIPTION
Documentation/git-merge.txt: get rid of irrelevant references to
git-pull
Documentation/git-merge.txt | 63 ++++++++++++++++++++++-----------------------
builtin/merge.c | 2 +-
2 files changed, 32 insertions(+), 33 deletions(-)
--
2.10.0.1.g57b01a3
From: Sergey Organov <redacted>
This partial list of option is confusing as it lacks a lot of
available options. It also clutters the SYNOPSIS making differences
between forms of invocation less clear.
Signed-off-by: Sergey Organov <redacted>
---
Documentation/git-merge.txt | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
From: Sergey Organov <redacted>
Old description had a few problems:
- sounded as if commits have changes
- stated that changes are taken since some "divergence point"
that was not defined.
New description rather uses "common ancestor" and "merge base",
definitions of which are easily discoverable in the rest of GIT
documentation.
Signed-off-by: Sergey Organov <redacted>
---
Documentation/git-merge.txt | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
@@ -16,11 +16,16 @@ SYNOPSIS DESCRIPTION ------------Incorporates changes from the named commits (since the time their-histories diverged from the current branch) into the current-branch. This command is used by 'git pull' to incorporate changes-from another repository and can be used by hand to merge changes-from one branch into another.++Incorporates changes that lead to the named commits into the current+branch, and joins corresponding histories. The best common ancestor of+named commits and the current branch, called "merge base", is+calculated, and then net changes taken from the merge base to+the named commits are applied.++This command is used by 'git pull' to incorporate changes from another+repository, and can be used by hand to merge changes from one branch+into another. Assume the following history exists and the current branch is "`master`":
@@ -31,11 +36,11 @@ Assume the following history exists and the current branch is D---E---F---G master -------------Then "`git merge topic`" will replay the changes made on the-`topic` branch since it diverged from `master` (i.e., `E`) until-its current commit (`C`) on top of `master`, and record the result-in a new commit along with the names of the two parent commits and-a log message from the user describing the changes.+Then "`git merge topic`" will replay the changes made on the `topic`+branch since it diverged from `master` (i.e., `E`) until its current+commit (`C`) on top of `master`, and record the result in a new commit+along with references to the two parent commits and a log message from+the user describing the changes. ------------ A---B---C topic
From: Sergey Organov <redacted>
"-m <msg>" is one of essential distinctions between obsolete
invocation form and the recent one. Add it to the "usage" returned by
'git merge -h' for more clarity.
Signed-off-by: Sergey Organov <redacted>
---
builtin/merge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Sergey Organov <redacted>
No awareness of git-pull is required to understand git-merge operation,
so leave reference to git-pull only where it actually makes sense, in
the description of fast-forward merges, and only as clarification of
when this merging behaviour is mostly useful.
Other references to git-pull are likely just a historical leftover
that are now neither required nor clarify anything. Besides, git-pull
may use rebase rather than merge, so it's also technically wrong to
say, unconditionally, that git-pull uses git-merge.
Overall, let git-pull description refer to git-merge where
appropriate, and not vice versa.
Signed-off-by: Sergey Organov <redacted>
---
Documentation/git-merge.txt | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
@@ -23,10 +23,6 @@ named commits and the current branch, called "merge base", is calculated, and then net changes taken from the merge base to the named commits are applied.-This command is used by 'git pull' to incorporate changes from another-repository, and can be used by hand to merge changes from one branch-into another.- Assume the following history exists and the current branch is "`master`":
@@ -119,18 +115,17 @@ of `git fetch` for merging are merged to the current branch. PRE-MERGE CHECKS -----------------Before applying outside changes, you should get your own work in-good shape and committed locally, so it will not be clobbered if-there are conflicts. See also linkgit:git-stash[1].-'git pull' and 'git merge' will stop without doing anything when-local uncommitted changes overlap with files that 'git pull'/'git-merge' may need to update.+Before applying outside changes, you should get your own work in good+shape and committed locally, so it will not be clobbered if there are+conflicts. See also linkgit:git-stash[1]. 'git merge' will stop+without doing anything when local uncommitted changes overlap with+files that 'git merge' may need to update.-To avoid recording unrelated changes in the merge commit,-'git pull' and 'git merge' will also abort if there are any changes-registered in the index relative to the `HEAD` commit. (One-exception is when the changed index entries are in the state that-would result from the merge already.)+To avoid recording unrelated changes in the merge commit, 'git merge'+will also abort if there are any changes registered in the index+relative to the `HEAD` commit. (One exception is when the changed+index entries are in the state that would result from the merge+already.) If all named commits are already ancestors of `HEAD`, 'git merge' will exit early with the message "Already up-to-date."
@@ -138,14 +133,15 @@ will exit early with the message "Already up-to-date." FAST-FORWARD MERGE -------------------Often the current branch head is an ancestor of the named commit.+Often the current branch head is an ancestor of the named commit. In+this case, a new commit is not needed to store the combined history;+instead, the `HEAD` (along with the index) is updated to point at the+named commit, without creating an extra merge commit.+ This is the most common case especially when invoked from 'git pull': you are tracking an upstream repository, you have committed no local changes, and now you want to update to a newer upstream-revision. In this case, a new commit is not needed to store the-combined history; instead, the `HEAD` (along with the index) is-updated to point at the named commit, without creating an extra-merge commit.+revision. This behavior can be suppressed with the `--no-ff` option.
From: Sergey Organov <redacted>
Old description not only raised the question of why the tool is called
git-merge rather than git-join, but "join histories" also sounds like
very simple operation, something like what "git-merge -s ours" does.
Signed-off-by: Sergey Organov <redacted>
---
Documentation/git-merge.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -3,7 +3,8 @@ git-merge(1) NAME -----git-merge - Join two or more development histories together++git-merge - Merge one or more branches to the current branch SYNOPSIS
From: Jakub Narębski <hidden> Date: 2016-10-05 16:58:32
W dniu 05.10.2016 o 16:46, sorganov@gmail.com pisze:
From: Sergey Organov <redacted>
Old description had a few problems:
- sounded as if commits have changes
- stated that changes are taken since some "divergence point"
that was not defined.
New description rather uses "common ancestor" and "merge base",
definitions of which are easily discoverable in the rest of GIT
documentation.
This is a step in a good direction, but it has a few issues.
@@ -16,11 +16,16 @@ SYNOPSIS DESCRIPTION ------------Incorporates changes from the named commits (since the time their-histories diverged from the current branch) into the current-branch. This command is used by 'git pull' to incorporate changes-from another repository and can be used by hand to merge changes-from one branch into another.++Incorporates changes that lead to the named commits into the current+branch, and joins corresponding histories. The best common ancestor of+named commits and the current branch, called "merge base", is+calculated, and then net changes taken from the merge base to+the named commits are applied.
The first sentence is all right; it reads better than the original
without the introduced part in parentheses. The only minor issue
is with "joins corresponding histories" - it is a good description,
but may imply that the branch we are merging vanishes: it doesn't.
But all in all, it is a good change.
Second sentence has some problems. First, while it is a good idea
to use well defined term "merge base", I think writing "since the
time their histories diverged" or "(which is the point where histories
diverged)" would be a good plain language description; it was removed
entirely in the proposal.
Second, while "common ancestor" and "least common ancestor" are well
defined in mathematics of graphs, "best common ancestor" isn't...
but this is what git-merge-base(1) documentation uses.
Also, the "best common ancestor" doesn't need to be only one. There
might be many such ancestors... though Git would generate then a
virtual best common ancestor thanks to recursive merge strategy.
And usually there is only one "best common ancestor", that is a single
merge base. So this may need clarification, but it is not much of
a problem.
Third, and most important, is that "net changes taken from the merge
base to the named commits are applied" is simply not true. The
`git merge` command does not reapply changes - that is what rebase
and cherry-pick do. The merge operation uses 3-way merge strategy
(diff3) between merge-base, current branch, and merged commit.
That is, it finds differences between differences, and "applies"
that.
See "A Formal Investigation of Diff3" paper by Sanjeev Khanna,
Keshav Kunal, and Benjamin C. Pierce:
http://www.cis.upenn.edu/~bcpierce/papers/diff3-short.pdf
I'm not sure how to explain it succintly. Perhaps
net changes between merge base to the current (merged into)
branch and named commits are integrated
There is description of trivial 3-way merge somewhere in Git docs,
though in very unobvious place; we can link it.
+
+This command is used by 'git pull' to incorporate changes from another
+repository, and can be used by hand to merge changes from one branch
+into another.
Rather "can be used by 'git pull'", or "is used by 'git pull' (unless
configured otherwise)"...
Separating this information makes a very good sense. Thanks.
quoted hunk
Assume the following history exists and the current branch is
"`master`":
@@ -31,11 +36,11 @@ Assume the following history exists and the current branch is D---E---F---G master -------------Then "`git merge topic`" will replay the changes made on the-`topic` branch since it diverged from `master` (i.e., `E`) until-its current commit (`C`) on top of `master`, and record the result-in a new commit along with the names of the two parent commits and-a log message from the user describing the changes.+Then "`git merge topic`" will replay the changes made on the `topic`+branch since it diverged from `master` (i.e., `E`) until its current+commit (`C`) on top of `master`, and record the result in a new commit+along with references to the two parent commits and a log message from+the user describing the changes.
What the happened here!?! Please do not rewrap documentation, especially
not without changes!
@@ -3,7 +3,8 @@ git-merge(1) NAME -----git-merge - Join two or more development histories together++git-merge - Merge one or more branches to the current branch
I wonder if we should be more clear that you don't have to merge a
branch; you can merge any commit. I do agree that the original was
unnecessarily general. And I think "the current branch" is accurate
(technically it can be to a detached HEAD, but that is pedantry that
doesn't need to make it into the synopsis).
So maybe "Merge one or more commits into the current branch". I guess
that is a bit vague, too. It is really "commit tips" or "lines of
development" that we are merging. Bringing them in of course brings in
many commits, but the "or more" there is meant to hint at multi-parent
merges.
So perhaps "one or more branches", while not completely accurate, is the
best we can do. I dunno.
-Peff