• Documentation
  • Pricing
© 2026 Serverless, Inc. All rights reserved.

Framework

  • Overview
  • Documentation
  • Plugins360
  • Pricing

Learn

  • Blog
  • GuidesUpdated
  • Examples240
  • Courses

Resources

  • Support
  • Security
  • Trust Center
  • Status

Community

  • Slack
  • GitHub47k
  • Forum
  • Meetups

Company

  • About
  • Careers
  • Contact
  • Partners

Legal

  • Terms of Service
  • Privacy Policy
  • Trademark
  • DMCA
Serverless Framework Logo

Serverless Framework

Intro
SetupUpgrading To V4ConceptsTutorialAWS CredentialsLicense Keys
DeployingPackagingBuildingTestingServicesFunctions
OverviewHTTP (API Gateway v2)REST (API Gateway v1)ActiveMQApplication Load BalancerAlexa SkillAlexa Smart HomeCloudWatch EventCloudWatch LogCloudFrontCognito User PoolEventBridge EventIoTIoT Fleet ProvisioningKafkaKinesis & DynamoDBMSKRabbitMQS3ScheduleSNSSQSWebsocket
LayersManaged InstancesAlertsVersion PruningDomainsIAM Function PermissionsParameters
OverviewSelf-reference serverless.ymlServerless CoreEnvironment VariablesCLI OptionsExternal YAML/JSON FilesJavascript propertiesGitDoppler
OverviewS3 ObjectsSSM Parameter Store & Secrets ManagerCloudFormation Stack Outputs
OverviewVaultTerraform State Output
ResourcesComposing ServicesDeployment BucketStatePython support
OverviewRuntimeGatewayMemoryBrowserCode InterpreterDev Mode
API Gateway Proxy
OverviewGeneral ConfigurationAuthenticationAPI KeysData SourcesResolversPipeline FunctionsCachingDelta SyncCustom DomainWAFCLI Commands
Deploying SAM/CFN TemplatesWorkflow Tips
OverviewCreating PluginsCLI OutputCustom CommandsCustom VariablesExtending the Configuration schemaExtending and overriding configuration
OverviewDashboardAxiom
Overviewpackagedevdeploydeploy functiondeploy listinvokeinvoke locallogsloginlogin awslogin aws ssometricsinforollbackrollback functionremoveplugin installplugin uninstallprintprunesupportusagereconcile
Overview
OverviewMetricsTracesTroubleshoot
OverviewNode.jsPython
OutputsProviders
OverviewBranch DeploymentsPreview DeploymentsCustom ScriptsTestingPrivate PackagesNotificationsMono ReposDeploy in your own CI/CDBest PracticesTroubleshootingFAQ
OverviewSetupToolsAWS Integration
Serverless.yml Reference
Examples and TutorialsConfiguration Validation
  1. Usage
  2. Variables
  3. Git

Reference Git Variables

You can leverage Git-related information in your serverless.yml configuration using Git variables. This allows you to include dynamic data related to your Git environment directly into your deployment configuration.

Available Git Variables:

  • describe: A representation of the latest commit, using tags if available, otherwise the short SHA-1 hash.
  • describeLight: Like describe but only considers lightweight (non-annotated) tags.
  • sha1: The short SHA-1 hash of the latest commit.
  • commit: The full SHA hash of the latest commit.
  • branch: The name of the current branch.
  • message: The full commit message of the latest commit.
  • messageSubject: The subject line of the commit message.
  • messageBody: The body of the commit message.
  • user: The name of the user from Git configuration.
  • email: The email address of the user from Git configuration.
  • isDirty: Indicates whether there are uncommitted changes (returns 'true' or 'false').
  • repository: The name of the repository.
  • tags: The tags pointing at the current commit, or the short SHA-1 hash if no tags are present.

Syntax

To reference Git variables, use the ${git:<variable>} syntax in your serverless.yml. Here's how you might use these variables:

service: new-service
functions:
  hello:
    name: hello-${git:branch}
    handler: handler.hello
    description: ${git:message}

In the above configuration, the service and function names will dynamically include the branch name, and the function description will include the commit message.

Edit this page
Prev Javascript propertiesNextDoppler

Contents

  • Reference Git Variables
  • Available Git Variables:
  • Syntax

Related

GuidesPluginsExamplesSlack CommunitySupport