# Что такое commits, branches в Git?

#### **Commit**

* Commit — это **снимок состояния вашего репозитория в конкретный момент времени**.
* Содержит:
  * Изменённые файлы.
  * Сообщение (commit message), которое объясняет, что было сделано.
  * Уникальный идентификатор (SHA-1 hash).
* Commit позволяет откатываться к предыдущим версиям кода или отслеживать историю изменений.

Пример команды:

```bash
git add file.txt       # добавляем изменения в индекс
git commit -m "Добавил новую функцию"  # фиксируем изменения
```

***

#### **Branch**

* Branch — это **ветка разработки**, отдельная линия изменений в проекте.
* Основная ветка обычно называется `main` или `master`.
* Ветки позволяют:
  * Параллельно разрабатывать разные функции.
  * Тестировать изменения, не ломая основной код.
  * Объединять изменения через merge или rebase.

Примеры команд:

```bash
git branch new-feature        # создать ветку
git checkout new-feature      # переключиться на ветку
git merge new-feature         # объединить ветку с текущей
```

***

**Идея в целом:**\
Commit — это **фиксированное состояние кода**, branch — это **путь, по которому идут эти фиксации**.


---

# 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://kaze.gitbook.io/qa-theory/git/chto-takoe-commits-branches-v-git.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.
