gpt4 book ai didi

Git - 重新定位到主人不做任何事情

转载 作者:行者123 更新时间:2023-12-05 00:41:01 25 4
gpt4 key购买 nike

我创建了一个实验分支。我已经决定了这是我想要采取的方向,所以想把改变放到主人身上。

我不想 merge ,我更喜欢 rebase ,因为这听起来正是我想要的(就像我一直在使用 master)。

documentation ,看起来很简单(这是来自文档的说明):

However, there is another way: you can take the patch of the change that was introduced in C4 and reapply it on top of C3. In Git, this is called rebasing. With the rebase command, you can take all the changes that were committed on one branch and replay them on another one.

In this example, you’d run the following:

$ git checkout experiment
$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: added staged command

在我的例子中,'experiment' 是已经 checkout 的分支'denormalized'(从我的控制台输出):

$ git status
On branch denormalized
Your branch is up-to-date with 'origin/denormalized'.
nothing to commit, working tree clean

现在,我调用 git rebase master:

$ git rebase master
Current branch denormalized is up to date.

好的,根据文档,这不是我所期望的。两个分支似乎也没有变化:

enter image description here

master 仍然是 rebase 之前的样子。我可以检查一下,没有任何变化。

我错过了什么?

最佳答案

要将这些更改导入master,您需要做什么:

git checkout master
git merge denormalized

merge 会将这些更改 pull 入您的分支。

rebase 做了什么,它将这些提交从头上链接起来,但仍然在您的其他引用上。

merge 后,你应该在 -Refactored the generator...

得到 masterdenormalized HEADs

它在图 37 上方显示您可以执行此操作

关于Git - 重新定位到主人不做任何事情,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44114627/

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