Matteo Riva
Matteo Riva

Reputation: 25060

What causes git to make automatic commits on pull?

I have been working on different repositories and noticed a different behaviour: in one project when I pull other people's work into mine I just get their commit in my history, in another one git creates an automatic merge commit when I pull. In both cases there were no conflicts, and both repositories are bare repos on the same server.

What causes git to add or not add this automatic merge commit on pull?

Upvotes: 2

Views: 108

Answers (1)

pqnet
pqnet

Reputation: 6588

git pull is a shortcut for git fetch and git merge.

git merge will create a merge commit if the two branches diverged (i.e., you have local commits and there are remote commits).

You can use git pull --ff-only if you want it to fail if a merge commit is needed, then decide whether to merge manually, rebase or whatever.

Upvotes: 6

Related Questions