开发者

Git: How to merge/update parts of a branch from/to main?

开发者 https://www.devze.com 2023-02-16 22:45 出处:网络
I\'m a git newbie, and this is what I currently have: master: A -- B -- C \\ \\ branch:X -- Y How do I Update commit Y with

I'm a git newbie, and this is what I currently have:

master: A -- B -- C
          \
           \
branch:      X -- Y
  1. How do I Update commit Y with changes from B and C?

    Is this simply: git fetch machine master; 开发者_如何转开发git merge machine/master?

  2. Push changes of certain files from Y to C?


For 1:

git rebase master branch

This will result in

master: A -- B -- C
                   \
                    \
branch:              X' -- Y'

For 2 (while master is checked out):

git cherry-pick -n Y

This will apply changes from Y to your working tree and you may amend C with the changes you want.

See git-rebase(1) and git-cherry-pick(1).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号