You can use Cloud Source Repositories to browse to a file in a repository. You can choose to view the latest version of the file, or select a specific version of the file by choosing a branch, tag, or commit.
View the latest version of a file
For most Git repositories, the latest version of a file refers to the last
commit of the file in the master
branch. You can get to this version of a file
from the All repositories page.
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.
View a file by using a different branch
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.
On the Breadcrumb toolbar, click the Branch drop-down list, click Branch, and then click the branch you want to view.
The repository view changes to reflect the selected branch.
Browse to the file you want to view and click it.
View a file by using a different tag
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.
On the Breadcrumb toolbar, click the Branch drop-down list, click Tag, and then click the tag you want to view.
The repository view changes to reflect the selected tag.
Browse to the file you want to view and click it.
View a file at a different commit
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.
On the Breadcrumb toolbar, click the Branch drop-down list, click Commit, and then click the commit you want to view.
The view of the repository changes to reflect its state at the selected commit.
Browse to the file you want to view and click it.
Navigate to the outline view
Cloud Source Repositories supports an outline view for many common types of files, including those written in Java, C++, Python, JavaScript, and Go. The outline view shows the structure of the file as a tree, where key identifiers are the nodes. The outline view can help you understand the overall structure of a file and navigate its contents.
In your repository, click the Files tab, browse to a file, and then click the file.
Click the Outline tab.
Click an identifier to go to its starting location in the file.