1

I'm having trouble checking out a commit using labels.

I had made a commit and labelled the commit 1.0. I had to do some rebasing that ended changing some of the commits in my history which lead me needing to relabel the 1.0 tag on a new commit. When I manually checked out the label using git checkout 1.0 the new commit is checked out and it works great. There is a scenario where checking out the label ends up pointing to the old commit... The scenario is when I use a python script to perform the git checkout and I have the script called from a Bamboo Atlassian Job.

Does anyone know what could be causing the history not to be updated? Note that the bamboo job cleans up it's environment every time.

tyleax
  • 1,556
  • 2
  • 17
  • 45

1 Answers1

1

One possibility is that you have not deleted/push back the tag that you just moved locally.

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

If pushed, the Bamboo job would be able to fetch then checkout the right commit for the 1.0 tag.

The OP tyleax adds 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

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Thanks! This helped me the most of the way. 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. – tyleax Oct 07 '19 at 20:14
  • 1
    @tyleax Thank you for the feedback. I have included your comment in the answer for more visibility. – VonC Oct 07 '19 at 20:18