当我将其他分支合并到master时,我希望没有其他分支历史提交。我该怎么做?
我们知道:
git pull——rebase origin test意思是:只有历史提交没有合并提交。
git pull——没有ff origin测试意味着:历史提交和合并提交。
git pull--ff only origin test意思是:只有历史提交没有合并提交。
我想“只合并提交”,怎么办?请。这样地:
https://github.com/torvalds/linux/commits/master
进一步的问题:
如果我使用“--squash”,则在合并时它不会自动记录“merge branch'xxx'of xxxx”或“merge tag'xxx'of xxxx”。需要写在我手上吗?

最佳答案

注意,您还可以将合并的分支配置为自动压缩要合并的提交(如this discussion):

git config branch.<name>.mergeoptions --squash

git config有:
branch.<name>.mergeoptions

设置合并到branch<name>的默认选项。
语法和支持的选项与git-merge的相同,但当前不支持包含空白字符的选项值。
这样,您就不必在git merge中添加任何额外选项。
如“In git, what is the difference between merge --squash and rebase?”中所述,它不会记录合并:
这将记录合并:
git config branch.<name>.mergeoptions --no-ff

09-04 08:14
查看更多