使用bamb时重新标记后链接到旧提交的Git标签

2024-06-07 20:58:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我无法使用标签签出提交

我做了一个提交,并给提交加了标签1.0。我不得不做一些重新调整,结束了对历史记录中的一些提交的更改,这导致我需要在新提交上重新标记1.0标记。当我使用git checkout 1.0手动签出标签时,新的提交被签出,并且工作得很好。在一个场景中,签出标签最终指向旧的提交。。。场景是当我使用一个python脚本执行git签出时,我从一个Bamboo Atlassian作业调用了这个脚本

有人知道是什么原因导致历史无法更新吗?请注意,竹子作业每次都会清理环境


Tags: 标记git脚本历史记录作业atlassian场景原因
1条回答
网友
1楼 · 发布于 2024-06-07 20:58:49

一种可能是你有not deleted/push back the tag你刚搬到本地

git push origin :refs/tags/<tagname>
git tag -fa <tagname>
git push origin master  tags

如果按下,Bamboo作业将能够获取然后签出1.0标记的正确提交

OP tyleax加上in the comments

I needed to do one more step.

Bamboo remote agents cache the git repository information. I had to delete the cache in xml-data/build-dir/_git-repositories-cache on the next checkout it was able to checkout the correct commit via label.
Without deleting, it was still pointing to the old commit

相关问题 更多 >

    热门问题