Git 分支删除警告 - 怎么办?

Git Branch Delete Warning - What to Do?

我是 Git 的新手,这是我第一次使用它,因为我使用 IntelliJ 14 开发 Flex 应用程序。

我正在我的 MacBook 上开发并且有一个本地存储库。我在我们的文件服务器上创建了一个远程存储库,它每晚都会备份,我会推送到它进行备份。

我从 Main 分支创建了一个 Dev 分支,从中我为一个重点开发领域创建了一个新分支,处理这个,将它合并到 Dev 分支,然后如果一切顺利,删除子分支。

在我完成的最后一个开发领域,我检查了 Dev,合并了分支,然后当我去删除它时,我收到了以下警告:

The branch Filter_tasks is not fully merged to the branch refs/remotes/origin/Filter_Tasks. Below is a list of unmerged commits. The branch Filter_Tasks is however fully merged to the following branches: Key_Disable, dev. You may still delete the branch Filter_Tasks, but beware that it cannot be undone.

如果这看起来很明显,我深表歉意,但我不确定我哪里做错了,我现在应该怎么做。我假设我只需要检查我的本地开发分支并合并到那个分支,然后推送到文件服务器。该警告似乎暗示我需要合并到文件服务器上的分支。

非常欢迎提供一些指导。

您之前已将 Filter_tasks 推送到您的遥控器,然后在合并到 dev 之前在本地进行了一些处理。 Git 只是警告您尚未将最新更改推送到远程 Filter_tasks。由于您的参考分支是 dev,您不关心这个,您可以继续删除本地 Filter_tasks:

git branch -D Filter_tasks

您也可以从远程删除,因为不再需要它了:

git push origin :Filter_tasks

第二个命令的语法有点棘手。完整的形式是:

git push origin [local branch]:[remote branch]

如果将[local branch]留空,表示要删除[remote branch]

I apologise if it seems obvious but I am unsure of where I went wrong and what I should do now. I assume I only have to checkout my local dev branch and merge to that and then push to the Fileserver. The warning seems to imply that I need to merge to the branch on the Fileserver.

你是对的。 您可能需要在删除之前同步您的分支:

git pull origin Filter_tasks

所以你会在远程服务器上保存你的分支的副本,你可以安全地删除它。 否则,如果你一个人在你的项目上,你应该使用 -D(大写)选项强制删除分支:

git branch -D Filter_tasks

不要忘记在 Git 中,分支只是文件夹。他们是 "free" !