In script
section of gitlab job I want to determine if commit that triggered the job belongs to some branch.
$ git branch -a --contains $CI_COMMIT_SHORT_SHA
* (HEAD detached at 460a1f74)
I just see that head is detached on this commit, but I don't see name of branch I just pushed (which was containing this commit)
Then I run this command but with specified commit (same as above) in my local terminal.
git branch -a --contains 460a1f74
* (HEAD detached at 460a1f74)
deploy-job
remotes/origin/deploy-job
It outputs branches properly.
And then I've tried to run it with older specific commit from the same branch in script on gitlab's job:
$ git branch -a --contains 460a2f55
* (HEAD detached at 460a2f55)
remotes/origin/deploy-job
It outputs branch properly.
Why I don't see my branch in a first case?