Push commits to another branch

前端 未结 9 1304
走了就别回头了
走了就别回头了 2020-11-29 14:38

Is it possible to commit and push changes from one branch to another.

Assume I commited changes in BRANCH1 and want to push them to BRANCH2<

9条回答
  •  误落风尘
    2020-11-29 15:11

    I got a bad result with git push origin branch1:branch2 command:

    In my case, branch2 is deleted and branch1 has been updated with some new changes.

    Hence, if you want only the changes push on the branch2 from the branch1, try procedures below:

    • On branch1: git add .
    • On branch1: git commit -m 'comments'
    • On branch1: git push origin branch1

    • On branch2: git pull origin branch1

    • On branch1: revert to the previous commit.

提交回复
热议问题