5

Git pull 作品没有显示任何更新:

sh-3.2$ git pull
Already up-to-date.

当我执行 git push 时出现错误:

sh-3.2$ git push --tags
To user@example.com:some/git/repo
 ! [rejected]        DEVEL_BLEEDINGEDGE -> DEVEL_BLEEDINGEDGE (non-fast-forward)
error: failed to push some refs to 'user@example.com:some/git/repo'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

变基给出相同的结果:

sh-3.2$ git pull --rebase
Current branch devel is up to date.

DEVEL_BLEEDINGEDGE 标签用于我的日常自动构建脚本,每次我需要使用这些脚本部署一些新内容时,我都会使用以下代码移动该标签:

git tag -f DEVEL_BLEEDINGEDGE

那么,为什么我不能推回我的标签呢?

对于我也不移动的其他标签,我时不时会收到此错误。

4

1 回答 1

10

看起来您想移动标签。标签旨在标记项目的特定状态,例如 1.0 版。这不应该每天都改变。如果你想改变(移动)一个标签,你可以使用 -f (强制)开关两次:

git tag -f TAG_I_MOVE
git push --tags -f

在您的情况下,我会使用分支来标记“开发人员最前沿”

git branch -f DEVEL_BLEEDINGEDGE HEAD
git push --tags

只要您在同一历史路径中向前移动您的 DEVEL_BLEEDINGEDGE 分支,这里不需要“-f”开关进行推送。

于 2013-03-15T12:23:23.210 回答