-->

什么是`--squash`和`--no-FF --no-commit`之间的区别是什么?(What

2019-06-27 02:37发布

哪一个应该使用隐藏microcommits?

是唯一的区别git merge --squashgit merge --no-ff --no-commit的其他家长的拒绝?

Answer 1:

差异

这些选项存在不同的用途。 你的资料库不同的结束。

让我们假设你的资料库是这样你做了专题分支发展后:

--squash

如果您签主,然后git merge --squash topic; git commit -m topic git merge --squash topic; git commit -m topic ,你会得到这样的:

--no-ff --no-commit

相反,如果你git merge --no-ff --no-commit; git commit -m topic git merge --no-ff --no-commit; git commit -m topic ,你会得到这样的:

隐藏微提交

如果你真的想隐藏(我的意思是,从你的资料库中删除 )你的微提交,使用--squash 。 因为,你可以在上面看到的图像,你是不是真的躲在你的微提交,如果你不壁球。 此外,你通常不会把你的话题转移到了世界。 主题分支是该课题获得成熟。

如果你希望你的历史,把所有的微提交,但让他们在发展另一条线(绿线在上面的图片),请使用--no-ff --no-commit 。 但请记住,一个),这是不是一个分支,和b)并不真正意味着什么Git的,因为它是你的承诺只是一个父。

请参考的Git分支-什么一个分支 ,如果你真的想了解。



文章来源: What are the differences between `--squash` and `--no-ff --no-commit`?