Track Code Deployment with Git Tags

📖 1 minute read

When managing releases via git tags, use git tag --contains <commit-sha> to check if specific code has been deployed yet. Combine with GitHub CLI to trace PR status: gh pr view <pr-number> --json mergeCommit gets the merge SHA, then check git tag --contains <sha> to see which releases include that change. Compare timestamps with git log <tag> -1 --format='%ci' to understand deployment timing. Useful for tracking when fixes reach production.

# Check if PR #123 is in any release
$ gh pr view 123 --json mergeCommit
{
  "mergeCommit": {
    "oid": "abc123..."
  }
}

# Check which tags contain this commit
$ git tag --contains abc123
v2024.03.10.1
v2024.03.11.1

# Compare timestamps
$ git log v2024.03.10.1 -1 --format="%H %ci"
abc123 2024-03-10 15:04:11 +0800

Daryle De Silva

VP of Technology

11+ years building and scaling web applications. Writing about what I learn in the trenches.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *