[英]Git merge branch from detached
I have sample where git merge
gives unexpected for me result. 我有
git merge
给我意外结果的示例 。
Here master
branch has commit #3 with unwanted changes. 在这里,
master
分支的提交#3进行了不必要的更改。 I checkouts to stable commit #2 and creates new branch with additional usage. 我签出到稳定的提交#2并创建具有其他用法的新分支。 Can I merge
new_branch
into master
with all three lines? 我可以通过所有三
new_branch
合并到master
吗? Thanks for help! 感谢帮助!
You can merge new_branch
into master
then revert #3. 您可以将
new_branch
合并到master
然后还原#3。
Or, you can reset master
to new_branch
或者,您可以将
master
重置为new_branch
git checkout master git reset --hard new_branch
you should make commit #3
and #4
into new_branch, try rebase command 您应该将
#3
和#4
提交到new_branch中,尝试使用rebase命令
git checkout new_branch
git rebase master
git checkout master
git merge new_branch
If there is a conflict, you should resolve it. 如果有冲突,您应该解决它。
Or just make your changes into the master branch 或者只是将更改更改到master分支中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.