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

View Commit Details in AWS CodeCommit

You can use the AWS CodeCommit console to browse the history of commits in a repository. This can help you identify changes made in a repository, including:

  • When and by whom the changes were made.

  • When specific commits were merged into a particular branch.

Viewing the history of commits for a branch might also help you understand the difference between branches. If you use tagging, you can also quickly view the commit that was labeled with a specific tag and the parents of that tagged commit. At the command line, you can use Git to view details about the commits in a local repo or an AWS CodeCommit repository.

Browse Commits in a Repository

You can use the AWS CodeCommit console to browse the history of commits to a repository. You can also view a graph of the commits in the repository and its branches over time. This can help you understand the history of the repository, including when changes were made.

Note

Using the git rebase command to rebase a repository changes the history of a repository, which might cause commits to appear out of order. For more information, see Git Branching-Rebasing or your Git documentation.

Browse the Commit History of a Repository

You can browse the commit history for a specific branch or tag of the repository, including information about the committer and the commit message. You can also view the code for a specific commit.

To browse the history of commits (console)

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

  2. On the Dashboard page, from the list of repositories, choose the repository for which you want to review the commit history.

  3. In the navigation pane, choose Commits. In the commit history view, a history of commits for the repository in the default branch is displayed, in reverse chronological order of the commit date. Date and time are in coordinated universal time (UTC). You can view the commit history of a different branch by choosing the view selector button and then choosing a branch from the list. If you are using tags in your repository, you can view a commit with a specific tag and its parents by choosing that tag in the view selector button.

    
            The commit history view in the console
  4. To view the difference between a commit and its parent, and to see any comments on the changes, choose the abbreviated commit ID. For more information, see Compare a Commit to Its Parent and Comment on a Commit. To view the difference between a commit and any other commit specifier, including a branch, tag, or commit ID, see Compare Any Two Commit Specifiers.

  5. Do one or more of the following:

    • To view the date and time a change was made, hover over the days or months ago description.

    • To view the email associated with the author, hover over the user name.

    • To view the full commit ID, copy and then paste it into a text editor or other location. To copy it, choose the copy icon.

    • To view the code as it was at the time of a commit, choose the code icon (< / >) for the commit. The contents of the repository as they were at the time of that commit is displayed in the Code view. The view selector button displays the abbreviated commit ID instead of a branch or tag.

    • If the full commit subject is too long to fit in the initial view, choose the arrow next to the message. The commit message box expands to display up to 5,000 characters of the subject and message.

    • To collapse the list of commits for a particular date, choose the arrow next to that date.

View a Graph of the Commit History of a Repository

You can view a graph of the commits made to a repository. The Commit Visualizer view is a directed acyclic graph (DAG) representation of all the commits made to a branch of the repository. This graphical representation can help you understand when commits and associated features were added or merged. It can also help you pinpoint when a change was made in relation to other changes.

Note

Commits that are merged using the fast-forward method do not appear as separate lines in the graph of commits.

To view a graph of commits (console)

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

  2. On the Dashboard page, from the list of repositories, choose the repository for which you want to view a commit graph.

  3. In the navigation pane, choose Visualizer.

    
              A graphical view of a repository in the console

    In the commit graph, the subject for each commit message appears next to that point in the graph. You can use the direction buttons to change which side of the graph shows branches.

    Note

    The graph can display up to 35 branches on a page. If there are more than 35 branches, the graph is too complex to display. You can simplify the view in two ways:

    • By using the view selector button to show the graph for a specific branch.

    • By pasting a full commit ID into the search box to render the graph from that commit.

  4. To see more details about a commit point, choose the point in the graph.

    
              A detail view of a commit point

    The detail view shows:

    • The date of the commit.

    • The name of the author.

    • The subject and contents of the commit message (up to 200 characters).

    • The full commit ID.

    • The commit IDs of any parents of the commit.

    If the commit is a merge made by any method other than fast-forward, multiple parent IDs are displayed. To copy a commit ID, choose the copy icon next to that ID.

  5. To render a new graph from a commit, choose the commit ID in the detail view. The view selector button changes to the abbreviated commit ID.

    
              A new graph rendered from a specific commit

Use the AWS CLI to View Commit Details

Git lets you view details about commits. You can also use the AWS CLI to view details about the commits in a local repo or in an AWS CodeCommit repository, by running the following commands:

To view information about a commit

  1. Run the aws codecommit get-commit command, specifying:

    • The AWS CodeCommit repository's name (with the --repository-name option).

    • The full commit ID.

    For example, to view information about a commit with the ID 317f8570EXAMPLE in an AWS CodeCommit repository named MyDemoRepo:

    Copy
    aws codecommit get-commit --repository-name MyDemoRepo --commit-id 317f8570EXAMPLE
  2. If successful, the output of this command includes the following:

    • Information about the author of the commit (as configured in Git), including the date in time stamp format and the coordinated universal time (UTC) offset.

    • Information about the committer (as configured in Git) including the date in time stamp format and the UTC offset.

    • The ID of the Git tree where the commit exists.

    • The commit ID of the parent commit.

    • The commit message.

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

    Copy
    { "commit": { "additionalData": "", "committer": { "date": "1484167798 -0800", "name": "Mary Major", "email": "mary_major@example.com" }, "author": { "date": "1484167798 -0800", "name": "Mary Major", "email": "mary_major@example.com" }, "treeId": "347a3408EXAMPLE", "parents": [ "4c925148EXAMPLE" ], "message": "Fix incorrect variable name" } }

To view information about the changes for a commit specifier

  1. Run the aws codecommit get-differences command, specifying:

    • The name of the AWS CodeCommit repository (with the --repository-name option).

    • The commit specifiers you want to get information about. Only --after-commit-specifier is required. If you do not specify --before-commit-specifier, all files current as of the --after-commit-specifier will be shown.

    For example, to view information about the differences between commits with the IDs 317f8570EXAMPLE and 4c925148EXAMPLE in an AWS CodeCommit repository named MyDemoRepo:

    Copy
    aws codecommit get-differences --repository-name MyDemoRepo --before-commit-specifier 317f8570EXAMPLE --after-commit-specifier 4c925148EXAMPLE
  2. If successful, the output of this command includes the following:

    • A list of differences, including the change type (A for added, D for deleted, or M for modified).

    • The mode of the file change type.

    • The ID of the Git blob object that contains the change.

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

    Copy
    { "differences": [ { "afterBlob": { "path": "blob.txt", "blobId": "2eb4af3bEXAMPLE", "mode": "100644" }, "changeType": "M", "beforeBlob": { "path": "blob.txt", "blobId": "bf7fcf28fEXAMPLE", "mode": "100644" } } ] }

To view information about a Git blob object

  1. Run the aws codecommit get-blob command, specifying:

    • The name of the AWS CodeCommit repository (with the --repository-name option).

    • The ID of the Git blob (with the --blob-id option).

    For example, to view information about a Git blob with the ID of 2eb4af3bEXAMPLE in an AWS CodeCommit repository named MyDemoRepo:

    Copy
    aws codecommit get-blob --repository-name MyDemoRepo --blob-id 2eb4af3bEXAMPLE
  2. If successful, the output of this command includes the following:

    • The base64-encoded content of the blob, usually a file.

    For example, the output of the previous command might be similar to the following:

    Copy
    { "content": "QSBCaW5hcnkgTGFyToEXAMPLE=" }

Use Git to View Commit Details

Before you follow these steps, you should have already connected the local repo to the AWS CodeCommit repository and committed changes. For instructions, see Connect to a Repository.

To show the changes for the most recent commit to a repository, run the git show command.

Copy
git show

The command produces output similar to the following:

Copy
commit 4f8c6f9d Author: Mary Major <mary.major@example.com> Date: Mon May 23 15:56:48 2016 -0700 Added bumblebee.txt diff --git a/bumblebee.txt b/bumblebee.txt new file mode 100644 index 0000000..443b974 --- /dev/null +++ b/bumblebee.txt @@ -0,0 +1 @@ +A bumblebee, also written bumble bee, is a member of the bee genus Bombus, in the family Apidae. \ No newline at end of file

Note

In this and the following examples, commit IDs have been abbreviated. The full commit IDs are not shown.

You can also use the git show command with the commit ID to view the changes that occurred:

Copy
git show 94ba1e60 commit 94ba1e60 Author: John Doe <johndoe@example.com> Date: Mon May 23 15:39:14 2016 -0700 Added horse.txt diff --git a/horse.txt b/horse.txt new file mode 100644 index 0000000..080f68f --- /dev/null +++ b/horse.txt @@ -0,0 +1 @@ +The horse (Equus ferus caballus) is one of two extant subspecies of Equus ferus.

To see the differences between two commits, run the git diff command and include the two commit IDs.

Copy
git diff ce22850d 4f8c6f9d

In this example, the difference between the two commits is that two files were added. The command produces output similar to the following:

Copy
diff --git a/bees.txt b/bees.txt new file mode 100644 index 0000000..cf57550 --- /dev/null +++ b/bees.txt @@ -0,0 +1 @@ +Bees are flying insects closely related to wasps and ants, and are known for their role in pollination and for producing honey and beeswax. diff --git a/bumblebee.txt b/bumblebee.txt new file mode 100644 index 0000000..443b974 --- /dev/null +++ b/bumblebee.txt @@ -0,0 +1 @@ +A bumblebee, also written bumble bee, is a member of the bee genus Bombus, in the family Apidae. \ No newline at end of file

To use Git to view details about the commits in a local repo, run the git log command:

Copy
git log

If successful, this command produces output similar to the following:

Copy
commit 94ba1e60 Author: John Doe <johndoe@example.com> Date: Mon May 23 15:39:14 2016 -0700 Added horse.txt commit 4c925148 Author: Jane Doe <janedoe@example.com> Date: Mon May 22 14:54:55 2014 -0700 Added cat.txt and dog.txt

To show only commit IDs and messages, run the git log --pretty=oneline command:

Copy
git log --pretty=oneline

If successful, this command produces output similar to the following:

Copy
94ba1e60 Added horse.txt 4c925148 Added cat.txt and dog.txt

For more options, see your Git documentation.