pkaramol
pkaramol

Reputation: 19432

git: Auto merging vs normal (non-conflicting) merge?

I am on master.

Performing:

git merge feature_branch

Here is some indicative output:

   Auto-merging src/myproject/web/api/submodule/__init__.py
   Merge made by the 'recursive' strategy.
    src/myproject/application/cli.py                            |    4 +
    src/myproject/foo/__init__.py                             | 1167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    src/myproject/foo/auditors.py                             |  256 +++++++++++++++++++++++++++++++
    src/myproject/foo/handlers.py                             |  247 ++++++++++++++++++++++++++++++
    src/myproject/web/api/submodule/__init__.py              |   16 +-

Why only for the first file the action is "Auto-merging" is mentioned?

(which is not the case for the other files)

What is (could be) so special about it?

Upvotes: 3

Views: 2017

Answers (1)

jwg
jwg

Reputation: 5847

If a file is only modified on one of the two branches involved in the merge, than it will not be mentioned. No merge, automatic or manual, is needed for this file.

If the file has been modified on both branches, then first an auto-merge will be attempted. This usually succeeds in the following two cases:

  • The changes are to completely separate lines, with unchanged lines in between a line changed on one branch and a line changed on the other branch.
  • The changes give exactly the same end result, for example the same commit appears on both branches.

If these aren't the case, then the automatic merge will fail, and Git will resort to asking for a manual merge.

Upvotes: 5

Related Questions