簡體   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