Browsing files

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.

  1. 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.

  2. Click a repository.

    The Repository Root page opens.

  3. In the Files list, browse to the file you want to view, and then click it.

View a file by using a different branch

  1. In the GCP Console, open Cloud Source Repositories.

    Open Cloud Source Repositories

    The All repositories page opens. Alternatively, you can open the My source view.

  2. Click a repository.

    The Repository Root page opens.

  3. 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.

  4. Browse to the file you want to view and click it.

View a file by using a different tag

  1. In the GCP Console, open Cloud Source Repositories.

    Open Cloud Source Repositories

    The All repositories page opens. Alternatively, you can open the My source view.

  2. Click a repository.

    The Repository Root page opens.

  3. 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.

  4. Browse to the file you want to view and click it.

View a file at a different commit

  1. In the GCP Console, open Cloud Source Repositories.

    Open Cloud Source Repositories

    The All repositories page opens. Alternatively, you can open the My source view.

  2. Click a repository.

    The Repository Root page opens.

  3. 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.

  4. Browse to the file you want to view and click it.

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.

  1. In your repository, click the Files tab, browse to a file, and then click the file.

  2. Click the Outline tab.

    Outline View

  3. Click an identifier to go to its starting location in the file.