git - `git pull --rebase` 在功能分支上合并原始/主更改
问题描述
我已经阅读了许多关于 的文章和问题git pull --rebase
,但我不确定它如何适用于我的情况 - 特别是关于共享/公共分支
最初设定:
- 创建一个功能分支
master
,将其推送到远程 - 进行更改,在本地提交
- 将我的提交推送到远程功能分支
远程主站已更新
- 我想合并
master
对我的feature
分支的更改 git pull --rebase origin master
--rebase
考虑到我已经提交并推送它们,可以这样做吗?
根据 Atlassian 的更新
,一旦您的分支被推送(公开),请不要使用rebase
git rebase 的黄金法则是永远不要在公共分支上使用它。
https://www.atlassian.com/git/tutorials/merging-vs-rebasing#the-golden-rule-of-rebasing
解决方案
Is the --rebase ok to do given that I have already made commits and pushed them?
Maybe.
If other people have checked out your branch (and perhaps even made their own local commits), rebasing has the potential to cause a nightmare of merge conflicts. However, rebasing is often regarded as good housekeeping on projects to keep the history cleaner. When you rebase just before a merge, you are essentially injecting fast-forwardable commits. Without the rebase, you'll merge into your branch first, then push back, which can create messy situations if any individual commit of yours needs to be reverted.
No Rebase
(main) A - - - B - - - C - - - D E
\ \ /
(feature) F - - - G - - - H - - - I
Rebase
(main) A - - - B - - - C - - - D E
\ /
(feature) F - - - G - - - H
推荐阅读
- go - goroutine 在什么时候可以产生?
- c# - 将类型用作操作参数时的自定义编译错误
- twitter-bootstrap - Bootstrap 5 ReferenceError:未定义引导程序
- reactjs - TypeError:无法读取反应中未定义的属性“用户名”
- apache - 让我们使用 NGINX + Apache Docker swarm NET::ERR_CERT_INVALID 加密 SSL
- javascript - 如何获取vue js中所有列的总和
- python - df.isna().sum() 不适用于泰坦尼克数据集
- swift - Swift/URLSession 返回与 OpenSSL 不同的公钥
- twilio - 创建会议后立即拨打号码
- java - 数组快捷语法困境 | Java 编程语言