mercredi 8 février 2017

How to use git describe on a detached head commit?

Vote count: 0

I have a main branch that has annotated-non-lightweight-tagged commits in it. The workspace is in a detached head state, i.e. after checked out via Jenkins Multibranch Pipeline

When I run git describe I am getting the name of a really old tag, together with a very high number of commits since that tag, (e.g. 1.0.0-459-abc1234)

When I run git tag I get a list of all tags, including the most recent ones, that I am interested in, e.g. 3.1.0, 3.2.0.

I was then thinking about doing something like git branch -r --contains HEAD to get the name of the remote branch, then fetch and check that out (Running the risk that I am actually checking out a later commit than the one that triggered the pipeline, but whatever, it's isolated to a pull request anyways...) Or just run git describe <remote_branch_name> But neither of that worked. I don't understand why Git would prefer to show the very old tag instead of more recent ones, since any pull request is branched off the tag-containing master branch (every commit that had been tagged is guaranteed to be found on the master branch).

asked 31 secs ago

Let's block ads! (Why?)



How to use git describe on a detached head commit?

Aucun commentaire:

Enregistrer un commentaire