# Commits

Here are a little bit more details about commits.

### Each commit has a unique identifier

This identifier is a HASH string. A HASH is a deterministic value calculated based on an input. If the input changes, the HASH will also change. It's a quick way to compare two inputs are the same. In Git, the hash is long enough (256-bit) so that we can consider it to be a **unique** identifier for given a commit.

### Data integrity is protected

Each HASH actually takes two components:&#x20;

* the previous commit's hash and&#x20;
* the changes set in the current commit

Hence a certain HASH enforces the entire  history to be **exact** and **ineditable**. Any change in one commit will alter the current HASH and all downstream commit HASHes. This is like if the Terminator kills John, all history is rewritten.&#x20;

In addition, the *parent* HASH of a commit is also recorded. Hence if HASH is provided for one commit, the entire change history before it can be back traced.&#x20;

### Each commit has a message

The commit message is added using `git commit -m <msg>`.

The message documents what changes are made for documentation purposes. This will be shown in the `git log`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yu-sun.gitbook.io/essential-git-for-scientists/intermediate-concepts/commits.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
