Home > Enterprise >  cleanest way in git to get new changes to upstream branch to a feature branch
cleanest way in git to get new changes to upstream branch to a feature branch

Time:01-24

When I create a feature branch based off of an upstream branch, the feature branch will retain its branched off commit as the base of the upstream branch, when the upstream branch gets new changes merged in, what is the cleanest way of updating the feature branch's based off commit? the way I usually do it is

# checked out feature branch
git pull origin upstream-branch

the problem with this method is it creates a new commit in the commit tree and is not very clean, I haven't worked with rebase so a comprehensive guide for this use case would be fantastic

a visual of what I want to happen:

before:

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

after:

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

CodePudding user response:

pull -r auto-rebases your feature branch changes.

Provided there are no conflicts, this should work smoothly.

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