我有'develop'和'InitialPomChanges'分支.我想将develop分支的所有内容复制到InitialPomChanges分支.
Dav*_*sch 13
假设您要使用开发中的内容覆盖InitialPomChanges的所有内容(即您希望InitialPomChanges的内容与开发完全匹配),请执行以下操作:
git checkout InitialPomChanges
git checkout develop . #copies the contents of develop into the working directory
git commit -am "Making InitialPomChanges match develop"
Run Code Online (Sandbox Code Playgroud)
这将使InitialPomChanges中的最后一次提交与develop中的最后一次提交相匹配.为了使两个分支之间的未来合并更容易,现在做一个是个好主意git merge develop.
或者,如果要更改InitialPomChanges的内容并在一次提交中执行合并,则可以执行以下操作:
git checkout InitialPomChanges
git merge -s theirs develop
Run Code Online (Sandbox Code Playgroud)
你可以使用git merge或git rebase
如果你在InitialPomBranch上,你可以简单地运行
git merge develop
Run Code Online (Sandbox Code Playgroud)
要么
git rebase develop
Run Code Online (Sandbox Code Playgroud)
第一个将开发分支的所有提交合并到InitialPomBranch.第二个将把develop分支的所有提交放在InitialPomBranch的第一个提交之下
编辑:Rebase将更改InitialPomBranch的所有提交的SHA哈希值.所以你必须跑步
git push -f origin InitialPomBranches
Run Code Online (Sandbox Code Playgroud)
推动所有变化