git - 为什么默认情况下git在 merge 后提交?

标签 git merge

我对这种行为很好奇,也许这只是因为我主要使用 SVN 和 bazaar。 (我正在学习 git 以与出色的 github 交互。)

这对我来说似乎违反直觉,好像对

git merge [branch] --no-commit

作为默认设置,鼓励人们在提交之前确保 merge 按他们希望的方式进行。

最佳答案

Linus Torvalds 在创建 Git 时设定的目标是让所有可以自动解决的 merge ...FAST。查看他的 2007 Google Tech Talk: Linus Torvalds on Git (transcript)
IE。在不到几秒钟的时间内进行了数百次 merge 。

因此默认情况下“--no-commit”几乎会破坏该目的。

With --no-commit perform the merge but pretend the merge failed and do not autocommit, to give the user a chance to inspect and further tweak the merge result before committing.

摘自 Linus's talk (video) :

The only thing that matters is how fast can you merge.
In git, you can merge... I merge 22,000 files several times a day, and I get unhappy if a merge takes more than 5 seconds, and all of those 5 seconds is just downloading all the diffs, well not the diffs but its the deltas between two trees, the merge itself takes less than half a second.
And I do not have to think about it.
[...]That's the kind of performance that actually changes how you work.

关于git - 为什么默认情况下git在 merge 后提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5164418/

相关文章:

bash - FFMPEG:通过 RTP 的 32 channel 流式麦克风

sql-server - SSIS 14 - 暂存区 - 合并两个来源需要很多时间

git - 如何修复 Git 中的 'index-pack died of signal 15' 错误?

git rebase 私有(private)功能分支

git - 如何在 git 中为单个提交添加多个文件?

git - 后备/三向消息重设

git - 将更改从分支 A 应用到 B,而不 merge 或添加提交

git - 有没有办法从git下载一个子目录?

python - 在 python 或 numpy 中合并记录

python - 合并两个键中的 df,仅适用于一个键