繁体   English   中英

git 中将上游分支的新更改获取到功能分支的最干净的方法

[英]cleanest way in git to get new changes to upstream branch to a feature branch

当我基于上游分支创建功能分支时,功能分支将保留其分支提交作为上游分支的基础,当上游分支合并新更改时,更新功能分支的最干净的方法是什么基于提交? 我通常这样做的方式是

# checked out feature branch
git pull origin upstream-branch

这种方法的问题是它在提交树中创建了一个新的提交并且不是很干净,我没有使用过rebase所以这个用例的综合指南会很棒

我想要发生的事情的视觉效果:

前:

    feature branch  o--o--o--o
                   /
upstream commits  /  new changes
--o--o--o--o--o--o--o--o

后:

        feature branch    o--o--o--o
                         /
upstream commits        /
--o--o--o--o--o--o--o--o

pull -r auto-rebases 您的功能分支更改。

如果没有冲突,这应该可以顺利进行。

# checked out feature branch
git pull -r origin upstream-branch

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM