天天看点

Can I disable git pull?

Can I disable git pull?

I guess the problems you refer to are merge conflicts that may happen if your local branch diverged from the remote. In that case, try setting <code>pull.ff</code> option in git config, like that:

This will tell git to only do fast-forward merges, which are guaranteed to not result in conflicts.

git config --global pull.ff only  

https://git-scm.com/docs/git-config

pull.ff

By default, Git does not create an extra merge commit when merging a commit that is a descendant of the current commit. Instead, the tip of the current branch is fast-forwarded. When set to <code>false</code>, this variable tells Git to create an extra merge commit in such a case (equivalent to giving the <code>--no-ff</code> option from the command line). When set to <code>only</code>, only such fast-forward merges are allowed (equivalent to giving the <code>--ff-only</code> option from the command line). This setting overrides <code>merge.ff</code> when pulling.

merge.ff

By default, Git does not create an extra merge commit when merging a commit that is a descendant of the current commit. Instead, the tip of the current branch is fast-forwarded. When set to <code>false</code>, this variable tells Git to create an extra merge commit in such a case (equivalent to giving the <code>--no-ff</code> option from the command line). When set to <code>only</code>, only such fast-forward merges are allowed (equivalent to giving the <code>--ff-only</code> option from the command line).