I'm working with git and i want to disable git automatic merge on git pull
because sometimes it results of code errors since git merges based on line comparison .Is it possible to force GIT to always launch manual merge instead of automatic merge on git pull
, other words disable git automatic merge.

- 345
- 2
- 3
- 16
-
6Possible duplicate of [How to prevent an automerge using git?](https://stackoverflow.com/questions/5235010/how-to-prevent-an-automerge-using-git) – Phiter Dec 18 '17 at 15:58
-
already gone through this post , it's not what i'm asking , i'm asking if it's possible to bypass for good the automatic git merge process, the answer provided in the post restrict you to always go through git difftool before doing a git pull, whereas what i need is to disable git automatic merge. – AILY Dec 18 '17 at 16:19
-
No, but I'm curious why you would want to. – Edward Thomson Dec 18 '17 at 16:58
-
Sometimes merges cause errors, and to have full control of code i need to set a way to make git always run manual merge for developers – AILY Dec 18 '17 at 17:03
-
What do you call manual merge? – Federico Nafria Dec 18 '17 at 17:11
-
means i control the merges, do not let git add code for me – AILY Dec 19 '17 at 09:08
-
1Do you understand what a merge _is_? – evolutionxbox Dec 19 '17 at 10:57
-
@evolutionxbox can you please elaborate on that point ? – AILY Dec 19 '17 at 16:50
-
I guess what I'm asking is, what do you consider to be "unwanted merges"? As it raises questions about what you understand a merge to be. – evolutionxbox Dec 19 '17 at 17:05
-
merging doesn't add code semantically and this causes error since git merges by comparing lines and sometimes it happens that git merges code in a bad emplacement which causes errors so i don't want to let this marge of errors that why i want , always and everytime i do a git PULL , git to ask to merge manually – AILY Dec 20 '17 at 09:44
3 Answers
My guess on what you actually want here is to disable merge when there is no possibility to fast forward you current branch to the upstream branch.
By default git behavior is that when your local branch is different from the upstream git pull
runs merge. Merge in its turn will attempt to fast forward the branch and if it fails (this happens if your local branch is not a direct ancestor of the upstream branch position) it then tries merging it the "usual" way. In this case merge may result in merge conflicts that you'll have to resolve. This is I think is what you mention in your question and what you want to stop happening.
To prevent this situation you can configure git pull
to only perform merge if fast forward is possible. You can do this by specifying --ff-only
to git pull
invocation:
git pull --ff-only
Or you can make this the default behavior for git pull
by using git config
:
git config --global pull.ff only

- 984
- 12
- 20
There is no such thing like "manual merge".
However, if you want to inspect (and modify) the result of the merge
before committing it, you can add the --no-commit
command line flag to the git pull
command.
Git still does the merge but you can review and correct it (if needed). Then, when you are satisfied how the merged code looks like you can run git commit
to complete the merge (and the pull).

- 68,258
- 9
- 99
- 134