Prevent git from automatic commit after merge: --no-commit by default
I've switched to Git recently from bzr, and while I've gotten used to the differences there is one thing I am wondering if it is possible:
In bzr, when you merge there is not a implicit commit. The reasoning behind this is while the merge might have been technically successful, it might not have been contextually correct ie. not all of the unit tests pass after the merge so I may have to touch things up to make a "correct" merge.
I read the Git doc and thought I could do this with an alias, but it doesn't work:
[alias]
merge = 'merge --no-commit'
While I could just make a separate name for no-commit-merge, I would rather set this as the default behavior.
Other people suggest I 'rebase' with mas开发者_StackOverflowter, before merging back in. This would create a fast-forward merge, and would give me the chance to test the changes contextually before making it part of mainline but I would prefer to avoid rebase as much as possible.
So, is it possible to change the default merge behavior to --no-commit?
You can set the branch.<name>.mergeoptions
config appropriately with the no-commit
flag so that it does that by default:
branch.
<name>
.mergeoptionsSets default options for merging into branch
<name>
. The syntax and supported options are the same as those of git merge, but option values containing whitespace characters are currently not supported.
精彩评论