# Branch names vs Tag names

**URL:** <https://forum.buildkite.community/t/branch-names-vs-tag-names/974>\
**Category:** General\
**Created:** [April 3, 2020, 12:58pm UTC](https://forum.buildkite.community/t/branch-names-vs-tag-names/974 "2020-04-03T12:58:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![plannigan](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@plannigan](https://forum.buildkite.community/u/plannigan)\
**Post date:** [April 3, 2020, 12:58pm UTC](https://forum.buildkite.community/t/branch-names-vs-tag-names/974/1 "2020-04-03T12:58:10Z")

</div>

I would like to structure my pipeline so that certain steps only execute when a new tag to master is pushed. The general flow is that feature branches are worked on and merged to master. Then when we are ready, we tag master and trigger a release.

However, when this is done, `BUILDKITE_BRANCH` and `BUILDKITE_TAG` both have the tag name. Is the intended behavior? I would have expected `BUILDKITE_BRANCH` to always be the name of a branch. I understand that branches and tags aren’t that different as far as git is concerned. But it would be helpful if there were a way to determine the base branch that the tag was made against.

Looking at the webhook payload that Github Enterprise sends, it looks like `base_ref` has the necessary information. Is this something that could be made available if `BUILDKITE_BRANCH` and `BUILDKITE_TAG` having the same value is the intended behavior?

---

<div class="post-metadata">

**Author:** ![grant](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/grant/32/1157_2.png) [@grant](https://forum.buildkite.community/u/grant)\
**Post date:** [April 24, 2020, 4:11am UTC](https://forum.buildkite.community/t/branch-names-vs-tag-names/974/2 "2020-04-24T04:11:57Z")

</div>

Hey @plannigan, sorry you’ve run into trouble here. This one’s definitely a little confusing 😕 Triggering a release from a tag against master is a pretty common practice. Hopefully we can help you get back on track 👍

Due to how tags work in git, a branch is not easily inferred, nor is it required to check out a tag. For this reason we’re setting `BUILDKITE_BRANCH` and `BUILDKITE_TAG` to the same value. This is the intended behaviour. Our docs aren’t really clear on this and we’re updating them now.

If confirming the source branch is an important part of your build process, you could check that the ref that the tag points to exists in master. Another option would be to access the webhook payload in [our GraphQL API](https://buildkite.com/docs/apis/graphql-api).

If you’d like us to take a look at a specific build feel free to email [support@buildkite.com](mailto:support@buildkite.com) 📧

---

<div class="post-metadata">

**Author:** ![michael.proctor](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@michael.proctor](https://forum.buildkite.community/u/michael.proctor)\
**Post date:** [March 22, 2023, 10:57am UTC](https://forum.buildkite.community/t/branch-names-vs-tag-names/974/3 "2023-03-22T10:57:37Z")

</div>

I sent an email but have seen this thread and wanted to comment. I can see that the tag and branch values are the same, the issue I have is then the checkout fails.

```auto
error: pathspec '2.1.1' did not match any file(s) known to git
🚨 Error: The global checkout hook exited with status 1

```

Then if I try and run a build for the specific commit hash which has the tag, the value always is null. Why if I start a new build on the branch which contains the tag with that specific build does the tag value not be set?

This is for a BitBucket Cloud integration if that helps.

---

<div class="post-metadata">

**Author:** ![karen.sawrey](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/karen.sawrey/32/1188_2.png) [@karen.sawrey](https://forum.buildkite.community/u/karen.sawrey)\
**Post date:** [March 22, 2023, 1:53pm UTC](https://forum.buildkite.community/t/branch-names-vs-tag-names/974/4 "2023-03-22T13:53:18Z")

</div>

Hello, @michael.proctor, and welcome to the community!  
We’ve received your email, too, and we’re looking into the issue now. I’ll get back to you ASAP when I have more information.

Cheers!
