GIT: How to copy contents of one branch to other branch?

后端 未结 4 1520
情话喂你
情话喂你 2021-01-31 09:50

I have \'develop\' and \'InitialPomChanges\' branches. I want to copy all the contents of develop branch to InitialPomChanges branch.

4条回答
  •  梦谈多话
    2021-01-31 10:27

    You can use git merge or git rebase

    If you are on the InitialPomBranch, you can simply run

    git merge develop
    

    or

    git rebase develop
    

    The first one will merge all the commits of the develop branch on to InitialPomBranch. The second one will put all the commits of the develop branch below the first commit of the InitialPomBranch

    Edit: Rebase will change the SHA hashes of all the commits of the InitialPomBranch. So you will have to run

    git push -f origin InitialPomBranches 
    

    to push all the changes

提交回复
热议问题