从主分支中移除一个合并分支

编程入门 行业动态 更新时间:2024-10-24 21:20:58
本文介绍了从主分支中移除一个合并分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的master分支中,有以下已合并的本地分支,但我想从master中移除 local_branch3 :

local_branch1 local_branch2 local_branch3 local_branch4

从主服务器中删除 local_branch3 后,我希望它保持本地分支(只能从主服务器删除)。

我检查了史蒂夫哈曼的博客,但似乎也会永远删除本地分支。

,因为我发布在下面的评论之一:

我希望主分支撤消由local_branch3合并产生的更改,而保持local_branch3不变。

原因是我想要ke当我调整 local_branch3 时, $ master 分支可交付。

git checkout master git revert -m 1<<< SHA1值>>

然后在master分支中没有local_branch3代码。而locah_branch3将会保留。

In my master branch, there're following local branches that have been merged, but I would like to remove the local_branch3 from master:

local_branch1 local_branch2 local_branch3 local_branch4

after removing the local_branch3 from master, I would like it to remain a local branch (only deleted from master).

I've check Steve Harman's blog on this similar issue, but that seems also deleting the local branch for ever.

Edit: to clarify what I meant, as I posted in one of the below comments:

I would like the master branch to undo the changes resulting from local_branch3 merging, while leaving local_branch3 untouched.

The reason being that I would like to keep the master branch deliverable while I tweak on local_branch3.

解决方案

Maybe you mean reverting local_branch3 from master?

If so, first check SHA1 value of the commit which merges local_branch3. And

git checkout master git revert -m 1 <<SHA1 value>>

Then no local_branch3 codes in master branch. And locah_branch3 will remain.

更多推荐

从主分支中移除一个合并分支

本文发布于:2023-11-26 18:36:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634717.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分支   移除

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!