Learning from your code's history

This page describes how you can use Cloud Source Repositories to learn how files and repositories change over time.

Overview

Understanding the history of your code can help you make better decisions about new features and code changes. A repository's history can help you:

  • Understand why the code works the way it does.
  • Learn how other developers implemented a feature.
  • Understand why code changes occurred.
  • Investigate bugs or opportunities to improve performance.
  • Identify when code changes were introduced to narrow down the cause of a regression.

Finding your code's history

You can find your code's history in several ways:

  • The Commit Details view. This view displays information about commit changes, such as which files were changed in a commit. You can also follow the history of any changed files.
  • The Change History pane. This pane displays all commits applied to a file. From this pane, you can select a commit and open it in the Commit Details view. In addition, you can diff this file against a previous commit or compare it against another branch of the repository. To open the Change History pane, click Change history in the File view.
  • The Blame panel. While the Change History pane displays a list of commits that affect a file, the Blame panel displays a line-by-line history of changes. For each changed line, the Blame panel lists the name of the commit author. It also displays a number to indicate when the change occurred in the file's history. For example, a change that occurred in the first commit for the file would have a #1, the second would have a #2, and so on. You can hover over the change to see more details about the commit, and you can click the change to open the Change History pane with that change selected.

Performing code history tasks

To learn more about your code's history, see: