Skip to main content

What is commit history in Git?

The commit history in Git is the chronological chain of all saved changes in a repository.

Simply put: it is a log in which Git records who, when, and exactly what changed in the project.


What a commit is in this context

Each commit is:

  • a snapshot of the project's state at a specific point in time;
  • a recorded set of file changes;
  • a point you can return to.

Commits are linked to each other: each commit references the previous one, forming a chain (history).


What the commit history contains

For each commit, Git stores:

  • a unique identifier (hash), for example a3f5c9e
  • the author of the changes
  • the date and time
  • the commit message
  • the file changes (diff)
  • the parent commit (or several, if it is a merge)

What the history looks like in practice

The commit history is usually viewed with the command:

bash
git log

It shows the list of commits from newest to oldest:

  • the latest commit is the current state of the branch
  • below it are all the previous steps of development

Why the commit history is needed

The commit history lets you:

  • understand how the project evolved
  • find when and by whom a change was made
  • roll back to a previous state
  • compare file versions
  • safely experiment with code

In interviews this is often phrased as:

Git stores not just files, but the entire history of their changes.


An important point for interviews

The commit history in Git is not just a list. It is a graph (usually a tree), because:

  • there are branches
  • there are merges
  • a commit can have several parents

But in the simple case, it can be thought of as a chain of changes.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.