gpt4 book ai didi

git - 如何将远程主分支更改到本地开发分支?

转载 作者:太空狗 更新时间:2023-10-29 14:41:58 25 4
gpt4 key购买 nike

我想从 master 更新到我的开发分支,我尝试做的是应用以下命令:

 git checkout master
git pull
git checkout develop
git rebase master

通过执行上述命令,我得到以下警告:

首先,倒带头部以在其上重播您的作品...

此外,我不确定是否应该从 master 到 develop 执行 rebasemerge。我在网上引用了几篇文章,其中一篇建议为

Rebases are how changes should pass from the top of hierarchy downwards and merges are how they flow back upwards. (Link)

在微软Docs它建议在什么时候进行 rebase (例如,它显示将 develop rebase 到 master 上):

A suggested approach is to allow rebasing local changes that you have made but haven't shared with others, but to merge once you are sharing changes with others. This avoids trouble with rewriting history while still letting you easily catch up with changes as you develop your code locally.

我想知道将最新更改从 master 分支转移到 develop 分支的最佳方法。

最佳答案

以我的愚见,除非你是一个自信的 git 用户,否则 git rebase (-i) 会导致比它解决的问题更多的问题。

请注意,例如,GitHub 都不是也不Atlassian在他们的 git flow 教程中使用 rebase 。

当然 git flow 只是一种方法,Atlassian 在他们的 Feature Branch Workflow 中文章写道:

Once Bill is ready to accept the pull request, someone needs to merge the feature into the stable project (this can be done by either Bill or Mary):

git checkout master
git pull
git pull origin marys-feature
git push

This process often results in a merge commit. Some developers like this because it’s like a symbolic joining of the feature with the rest of the code base. But, if you’re partial to a linear history, it’s possible to rebase the feature onto the tip of master before executing the merge, resulting in a fast-forward merge.

我是 merge 提交的支持者,我建议您不要使用 rebase 。

关于git - 如何将远程主分支更改到本地开发分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51550616/

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