从主分支中移除一个合并分支 [英] Remove a single merged branch from master branch

查看:106
本文介绍了从主分支中移除一个合并分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的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.

这篇关于从主分支中移除一个合并分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆