Access the Commit Details view
You can access the Commit Details view in the following ways:
- From the Change History panel
- From the Commit link
Both options are available when you open a file or folder in Cloud Source Repositories.
The following table lists examples of fields you can access in your commit event:
Field name | Description |
---|---|
commit | the ID of your commit |
author | the author of the commit |
parents | the ID of the parent commits as a list |
subject | the subject of the commit |
message | the message of the commit |
For a list of additional fields, see CommitInfo.
Use the Change History panel
In the Google Cloud console, open Cloud Source Repositories.
Open Cloud Source Repositories
The All repositories page opens. Alternatively, you can open the My source view.
Click a repository.
The Repository Root page opens.
In the Files list, browse to the file you want to view, and then click it.
In the adjacent pane, click Change history.
In the pane that is displayed, each row shows the hash ID for that commit formatted as a hyperlink.
Click the hash ID link.
The Commit Details view opens.
Use the Commit Information link
You can also open the Commit Details view by clicking the Commit link.
If you're viewing the latest version of the file for that branch, the Commit Information link displays the name of the branch, along with the hash of latest commit.
If you're looking at a previous version of a file or folder, the Commit Information link displays the hash of the commit.
If you're looking at a particular tag, the Commit Information link displays the hash associated with the tag.
In all of these cases, click the hash of the commit to open the Commit Details view.
View line changes
You can use the Commit Details view to see which lines were changed in each file. To view which lines changed in a file, follow these steps.
Access the Commit Details view for a specific commit.
Locate the file you want to view, and then click the down arrow
to expand that row.The Files Changed section expands to display the changes made in that file.
If you want to simultaneously view all changes to a file, click Expand All in the Files Changed section.
Diff a file
To learn more about the changes to a specific file, open the Diff view. This view provides a diff of the file against the previous commit. You can also select other commits to compare the file against.
To diff a file, follow these steps:
Access the Commit Details view for a specific commit.
Click the path link for the file you want to view.
The Diff view opens. This view contains two panels. One panel displays the previous version of the file. The other panel displays the file as it existed at the time of the commit.
Compare commits
Another way to learn about how your code has changed over time is to compare one commit to another.
To compare two commits, follow these steps:
Access the Commit Details view for a specific commit.
Click Compare.
The Compare screen opens. This screen allows you to select two different commits. By default, this screen compares the commit you selected when you opened the Commit Details screen to its immediate parent.
You can select different commits using the Commit and To Parent drop-down lists on the Breadcrumb.
Navigate to a parent commit
Viewing the details of a specific commit can tell you a lot about what files were changed and why. You can get an even better understanding of your code's history by viewing the parent commit. A parent commit is a commit on which the current commit is based.
To access the parent commit, follow these steps:
Access the Commit Details view for a specific commit.
Click the link next to the Parent.
Often, a given commit has only a single parent. But there are times when a commit has multiple parents. This happens when a commit is the result of a merge of two or more branches. If a commit has multiple parents, the Commit Details view provides a drop-down list that you can use to diff against, and navigate to, a specific parent.