我正在学习 git/github/版本控制,我发现下图非常有用 ( source )。我的问题是 git merge
适合这个图表的什么地方?箭头从哪里开始并指向哪里?
最佳答案
作为I commented , "rebase
"是在 git pull --rebase
的上下文中:
- 从远程仓库获取
- 在刚刚被 fetch 更新的远程跟踪分支之上 rebase 。
A git merge
将在本地存储库和工作区之间:
- 本地存储库具有 merge 源:您要 merge 的内容来自,
- 工作区是您的工作树,您在其中检查了当前的工作分支:它是您要 merge 到的部分。
您需要一个工作区来解决可能的 merge 冲突。
同时 Schwern的 answer在技术上是正确的,但令人困惑。
该图的目的是向您展示在何处查看 git
命令执行。
来自“True Merge”
A merged version reconciling the changes from all branches to be merged is committed, and your HEAD, index, and working tree are updated to it.
It is possible to have modifications in the working tree as long as they do not overlap; the update will preserve them.
如果您要在裸存储库(没有工作树)中执行 git merge
,您将得到:
fatal: this operation must be run in a work tree
另见:
(来源:www.patrickzahnd.ch)
有关更具交互性的 Git 备忘单:an interaction from NDP Software, from Andrew Peterson :
不要忘记,在 Git 2.23(昨天发布)中,您有两个新的(实验性)命令:git switch
and git restore
.
他们可以澄清 git checkout
之前在做什么。
关于git - git merge 适合这个图中的什么地方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57547095/