我正在尝试配置本地git,使其在合并到develop分支时始终使用--squash。正如许多建议所建议的那样,我尝试了git config branch.develop.mergeoptions "–-squash",但它似乎没有效果:
> git checkout -b test_branch
> touch 1 2
> git add 1
> git commit -m "Added 1"
> git add 2
> git commit -m "Added 2"
> git checkout develop
> git merge test_branch
Updating e258d21..90a41ec
Fast-forward
1 | 0
2 | 0
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 1
create mode 100644 2我的预期是,git merge test_branch的结果与git merge --squash test_branch完全相同。但这显然不是真的: merge从test branch中提取了两个提交,而没有试图压缩它们。
我遗漏了什么?
本地配置的转储如下
$ git config --local --list
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git@yyy.com:repo/repo.git
gitflow.branch.master=master
gitflow.branch.develop=develop
gitflow.prefix.feature=feature/
gitflow.prefix.release=release/
gitflow.prefix.hotfix=hotfix/
gitflow.prefix.support=support/
gitflow.prefix.versiontag=
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.develop.remote=origin
branch.develop.merge=refs/heads/develop
branch.develop.rebase=true
branch.develop.mergeoptions=--ff-only –-squash
user.name=User Name
user.email=xxx@yyy.com
log.mailmap=true
push.default=simple发布于 2015-10-19 21:29:58
在git配置中传递选项时,您可能会输入错误。试试看:git config branch.develop.mergeoptions "--squash"有帮助吗?
https://stackoverflow.com/questions/33218578
复制相似问题