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
Download the most recent version of Git by going to http://git-scm.com
Initialize your Git repository by typing the following:
EB CLI will now recognize that your application is set up with Git.
If you haven't already run eb init, do that now:
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:
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
Add new and changed files to the staging area:
git add .
Deploy the staged changes with
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:
git tag -a v1.0 -m "My version 1.0"