Menu
AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)

Using the EB CLI with Git

The EB CLI provides integration with Git. This section provides an overview of how to use Git with the EB CLI.

To install Git and initialize your Git repository

  1. Download the most recent version of Git by going to http://git-scm.com

  2. Initialize your Git repository by typing the following:

    ~/eb$ git init

    EB CLI will now recognize that your application is set up with Git.

  3. If you haven't already run eb init, do that now:

    ~/eb$ eb init

To use different Git branches

You can associate your environment with different branches of your code so that when you work in a new branch, your default environment also uses that branch. For example, you can type the following to associate the running environment with your master and develop branches:

~/eb$ git checkout master
~/eb$ eb use prod
~/eb$ git checkout develop
~/eb$ eb use dev

By default, the EB CLI deploys the latest commit in the current branch, using the commit ID and message as the application version label and description, respectively. If you want to deploy to your environment without committing, you can use the --staged option to deploy changes that have been added to the staging area.

To deploy changes without committing

  1. Add new and changed files to the staging area:

    ~/eb$ git add .
  2. Deploy the staged changes with eb deploy:

    ~/eb$ eb deploy --staged

If you have configured the EB CLI to deploy an artifact, and you don't commit the artifact to your git repository, use the --staged option to deploy the latest build.

To assign Git tags to your application version

You can use a Git tag as your version label to identify what application version is running in your environment. For example, type the following:

~/eb$ git tag -a v1.0 -m "My version 1.0"