python - 使用 Bamboo 时重新标记后,Git 标签链接到旧提交

标签 python git bamboo

我在使用标签检查提交时遇到问题。

我进行了一次提交并将其标记为 1.0。我必须进行一些 rebase ,最终更改了我的历史记录中的一些提交,这导致我需要在新提交上重新标记 1.0 标记。当我使用 git checkout 1.0 手动 checkout 标签时,新提交已 checkout 并且效果很好。有一种情况是 checkout 标签最终指向旧提交...这种情况是当我使用 python 脚本执行 git checkout 并且从 Bamboo Atlassian 作业调用该脚本时。

有谁知道什么可能导致历史记录不更新?请注意, Bamboo 作业每次都会清理其环境。

最佳答案

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

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

如果推送,Bamboo 作业将能够获取并 checkout 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

关于python - 使用 Bamboo 时重新标记后,Git 标签链接到旧提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58244295/

相关文章:

python - google-app-engine中remote_api的 '<app-directory>'是什么

python - 使用 python 3 的 Twitter 流 API

git - magit:如何在同一分支上的两个不同提交之间区分同一文件?

python - 将 react 应用于分子 RDKit 时出现 sanitizer 错误

python - Windows 中的 Poetry 安装不起作用

powershell - Bamboo变量是否可以自动用作环境变量?

ant - 如何设置Bamboo与代码接收一起使用?

bash - cURL 调用 REST Api

git - 远程拒绝删除 git 远程分支

git - 为 Gerrit 及其所有 Git 存储库设置镜像的最佳方式