I want to use JGit API to retrieve the tags associated with a specific commit hash (if there is any)?
Please provide code snippet for the same.
If you know that there is exactly one tag for your commit, you could use describe, in more recent versions of JGit (~ November 2013).
Git.wrap(repository).describe().setTarget(ObjectId.fromString("hash")).call()
You could parse the result, to see if a tag exists, but if there can be multiple tags, you should go with Marcins solution.