GIT - 分支合并后不合并 [英] GIT - branches not closing after merge

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

问题描述

我们在使用GIT方面相当不熟悉。其实我们喜欢分支的想法;-)但不知何故,所有从一个用户合并,只是不关闭分支......

你可以看看这里的图像: http://i54.tinypic.com/297i14.png



有一条灰色和一条蓝色的线,它们直接前进......即使合并之后......那么他做错了什么?任何线索?我不想想象如果他创建更多的分支,并且所有这些分支在合并后仍然保留在历史视图中,会发生什么情况......



非常感谢!

解决方案

当您执行合并时,新的提交只会前移您当前的分支。指向其他分支的分支名称保留原来的位置。换句话说,如果你有这种情况:

  A --- B --- C蓝色
\
D --- E --- F灰色

...和do:

  git checkout blue 
git merge gray

您将得到:

  A --- B-- -C --- G蓝色
\ /
D --- E --- F灰色

如果你想删除灰色分支,你可以执行 git branch -d grey 。这不会影响提交图,只是删除分支 - 它们就像标签一样围绕提交图移动。



但是,如果继续并创建在灰色蓝色分支上提交更多,这些行将继续:

  A --- B --- C --- G --- H --- I blue 
\ /
D-- -E --- F --- J --- K --- L灰色

在我假设要么进一步提交进一步上面显示的部分,或者你使用的工具只是奇怪地呈现提交图。


we are pretty unexperienced in using GIT. Actually we like the idea of branches ;-) But somehow all merges from one user just don't close the branch...

You can look at the image here: http://i54.tinypic.com/297i14.png

There is a grey and a blue line which just got straight forward... even after the merge... So what is he doing wrong? Any clues? I don't want imagin what happens if he creates some more branches and all of them persist in the history view even after a merge...

Thank you very much!

解决方案

When you do a merge, the new commit only moves forward your current branch. The branch name that pointed to the other branch is left where it was. In other words, if you have this situation:

A---B---C blue
 \
  D---E---F grey

... and do:

git checkout blue
git merge grey

You'll end up with:

A---B---C---G blue
 \         /
  D---E---F grey

If you want to remove the grey branch you can then do git branch -d grey. This won't affect the commit graph, just remove the branch - they're like labels that get moved around the commit graph.

However, if you carry on and create more commits on the grey and blue branches, those lines will continue:

A---B---C---G---H---I blue
 \         /
  D---E---F---J---K---L grey

In the image you link to, I assume that either there are further commits further above the section you've shown, or the tool you're using is just presenting the commit graph strangely.

这篇关于GIT - 分支合并后不合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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