Push commits to another branch

前端 未结 9 1306
走了就别回头了
走了就别回头了 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:07

    Certainly, though it will only work if it's a fast forward of BRANCH2 or if you force it. The correct syntax to do such a thing is

    git push  : 
    

    See the description of a "refspec" on the git push man page for more detail on how it works. Also note that both a force push and a reset are operations that "rewrite history", and shouldn't be attempted by the faint of heart unless you're absolutely sure you know what you're doing with respect to any remote repositories and other people who have forks/clones of the same project.

提交回复
热议问题