简体   繁体   中英

Git - Update a PR that is merging release/x.x branch to master with updates from release/x.x

I have a Branch with a PR, from release/xx . I want to merge that to master and thus I did git merge origin/release/xx , from a branch that is branched of master .

In the meantime, an update came for release/xx . How can I update the PR with the new commit without opening a new PR?

Basically I want something like the below:

MASTER - MERGE-BRANCH (merge) - release/x.x
                          \    /
                        release/x.x(new)

I can't quite tell what your diagram is showing, but from your description, you currently have this:

        master
          |
          v
      x - x
     /     \
x - x       x <- merge-branch
     \     /
      x - x - x - x - x
          ^           ^
          |           |
       previous    release/x.x
       position of
       release/x.x

So the simple solution is just to checkout "merge-branch" and run git merge origin/release/xx again, which will give you this:

        master
          |
          v
      x - x
     /     \
x - x       x --------- x <- merge-branch
     \     /           /
      x - x - x - x - x
          ^           ^
          |           |
       previous    release/x.x
       position of
       release/x.x

A pull request tracks a branch, not a commit, so when you push "merge-branch" back to Github / Gitlab / wherever, the PR will be updated to include the extra changes.

If there aren't any conflicts to resolve, you don't even need "merge-branch" at all, you could just open the PR from release/xx into master, and merge it when you're ready.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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