To Display the current git commit hash execute the following snipped:
git rev-parse --short HEAD
To Extract this to use in a Jenkinsfile use the sh function with the script and returnStdout parameter set to true:
def commitHash = sh(script: 'git rev-parse --short HEAD', returnStdout: true)