Merge + Squash不会改变MERGE_HEAD?

时间:2014-09-24 06:35:08

标签: git github git-merge git-diff git-squash

我们正在一个团队工作,我们在当地的分支机构工作,每个人都在自己的分支机构工作,我们已经提交了几个分支机构并与--squash合并。

现在我们必须删除那些在“暂存”中合并的分支。分支。

问题在于我们命令' git diff'看到我们的分支,它表明所有被压扁的提交都是未合并的。

我们使用以下方法解决未合并的分支:

git branch -a --no-merged staging | grep github | cut -d/ -f3 > /not-gihub.txt   

谢谢!

1 个答案:

答案 0 :(得分:0)

What you're observing is the documented behavior: from man git-merge,

--squash

Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit, move the HEAD, or record $GIT_DIR/MERGE_HEAD (to cause the next git commit command to create a merge commit).

The ancestry information is not recorded into Git, so you'll have to get the information of whether a branch is merged by looking at the code (probably manually).