gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 01:11:09 26 4
gpt4 key购买 nike

我对这种行为很好奇,也许这只是因为我主要使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com