G.kalyan
G.kalyan

Reputation: 41

Merge always do rebase

I'm telling my developers don't use git merge command instead of that use git rebase. My requirement is if a user/developer accidentally hits git merge command i want disable the git merge (command) from git always.

Is that Possible to achieve This?

Or if the developer hits git merge it will perform rebase.

Upvotes: 2

Views: 534

Answers (2)

Jay P Singh
Jay P Singh

Reputation: 1

This option (git config --global pull.rebase true) will only work when I am trying to pull the changes from remote. But this doesn't work when I merging one local branch onto another. What is best way to disable merge command in git locally and globally both ?

Upvotes: 0

VonC
VonC

Reputation: 1323953

In addition of a pre-receive hook which detect any merge commit, you can also request for your team to use, with Git 2.6+:

git config --global pull.rebase true
git config --global  rebase.autoStash true

Any git pull would actually be a git pull --rebase, forcing them to always replay their local (yet to be pushed) commits on top of an updated remote tracking branch.

Upvotes: 1

Related Questions