Menu
AWS CodeCommit
User Guide (API Version 2015-04-13)

View Branch Details in AWS CodeCommit

To view details about the branches in an AWS CodeCommit repository, you can use the AWS CodeCommit console. You can view the date of the last commit to a branch, the commit message, and more. You can also use Git from a local repo connected to the AWS CodeCommit repository or the AWS CLI to view branch details.

Use the AWS CodeCommit Console to View Branch Details

Use the AWS CodeCommit console to quickly view a list of branches for your repository and details about the branches.

  1. Open the AWS CodeCommit console at https://console.aws.amazon.com/codecommit.

  2. In the list of repositories, choose the name of the repository.

  3. In the navigation pane, choose Branches.

    
            A view of branches in a repository.
  4. You can adjust the number of branches displayed on the Branches page by changing the number of branches shown on a page. The name of the branch used as the default for the repository is displayed next to the Default label. To view details about the most recent commit to a branch, choose the commit message. To view the files and code in a branch, choose the branch name.

Use Git to View Branch Details

To use Git from a local repo to view details about both the local and remote tracking branches for an AWS CodeCommit repository, run the git branch command.

The following steps assume you have already connected the local repo to the AWS CodeCommit repository. For instructions, see Connect to a Repository.

  1. Run the git branch command, specifying the --all option:

    Copy
    git branch --all
  2. If successful, this command returns output similar to the following:

    Copy
    MyNewBranch * master remotes/origin/MyNewBranch remotes/origin/master

    The asterisk (*) appears next to the currently open branch. The entries after that are remote tracking references.

    Tip

    git branch shows local branches.

    git branch -r shows remote branches.

    git checkout existing-branch-name switches to the specified branch name and, if git branch is run immediately afterward, displays it with an asterisk (*).

    git remote update remote-name updates your local repo with the list of available AWS CodeCommit repository branches. (To get a list of AWS CodeCommit repository names, along with their URLs, run the git remote -v command.)

For more options, see your Git documentation.

Use the AWS CLI to View Branch Details

To use AWS CLI commands with AWS CodeCommit, install the AWS CLI. For more information, see Command Line Reference.

To use the AWS CLI to view details about the branches in an AWS CodeCommit repository, run one or more of the following commands:

To view a list of branch names

  1. Run the list-branches command, specifying the name of the AWS CodeCommit repository (with the --repository-name option).

    Tip

    To get the name of the AWS CodeCommit repository, run the list-repositories command.

    For example, to view details about the branches in an AWS CodeCommit repository named MyDemoRepo:

    Copy
    aws codecommit list-branches --repository-name MyDemoRepo
  2. If successful, this command outputs a branchNameList object, with an entry for each branch.

    Here is some example output based on the preceding example command:

    Copy
    { "branches": [ "MyNewBranch", "master" ] }

To view information about a branch

  1. Run the get-branch command, specifying:

    • The repository name (with the --repository-name option).

    • The branch name (with the --branch-name option).

    For example, to view information about a branch named MyNewBranch in an AWS CodeCommit repository named MyDemoRepo:

    Copy
    aws codecommit get-branch --repository-name MyDemoRepo --branch-name MyNewBranch
  2. If successful, this command outputs the name of the branch and the ID of the last commit made to the branch.

    Here is some example output based on the preceding example command:

    Copy
    { "branch": { "branchName": "MyNewBranch", "commitID": "317f8570EXAMPLE" } }