Skip to content

Commit e63ec00

Browse files
moygitster
authored andcommitted
user-manual: Document that "git merge" doesn't like uncommited changes.
We explain the user why uncommited changes can be problematic with merge, and point to "commit" and "stash" for the solution. While talking about commited Vs uncommited changes, we also make it clear that the result of a merge is normally commited. Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4c371f9 commit e63ec00

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Documentation/user-manual.txt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,23 @@ $ git merge branchname
11831183
-------------------------------------------------
11841184

11851185
merges the development in the branch "branchname" into the current
1186-
branch. If there are conflicts--for example, if the same file is
1186+
branch.
1187+
1188+
A merge is made by combining the changes made in "branchname" and the
1189+
changes made up to the latest commit in your current branch since
1190+
their histories forked. The work tree is overwritten by the result of
1191+
the merge when this combining is done cleanly, or overwritten by a
1192+
half-merged results when this combining results in conflicts.
1193+
Therefore, if you have uncommitted changes touching the same files as
1194+
the ones impacted by the merge, Git will refuse to proceed. Most of
1195+
the time, you will want to commit your changes before you can merge,
1196+
and if you don't, then linkgit:git-stash[1] can take these changes
1197+
away while you're doing the merge, and reapply them afterwards.
1198+
1199+
If the changes are independant enough, Git will automatically complete
1200+
the merge and commit the result (or reuse an existing commit in case
1201+
of <<fast-forwards,fast-forward>>, see below). On the other hand,
1202+
if there are conflicts--for example, if the same file is
11871203
modified in two different ways in the remote branch and the local
11881204
branch--then you are warned; the output may look something like this:
11891205

@@ -1679,7 +1695,7 @@ Sharing development with others
16791695
Getting updates with git pull
16801696
-----------------------------
16811697

1682-
After you clone a repository and make a few changes of your own, you
1698+
After you clone a repository and commit a few changes of your own, you
16831699
may wish to check the original repository for updates and merge them
16841700
into your own work.
16851701

0 commit comments

Comments
 (0)