Suggest an editImprove this articleRefine the answer for “What is the git add command used for?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**`git add`** is used to add changes to the staging area (index), that is, to prepare files or parts of them for the next commit. **Key point:** `git add` does not save changes permanently and does not create a commit, it only marks changes that will go into the next commit.Shown above the full answer for quick recall.Answer (EN)Image`git add` is used to **add changes to the staging area (index)**, that is, to prepare files or parts of them for the next commit. ## What `git add` does After changing files: ```text Working directory → (git add) → Staging area → (git commit) → Repository ``` `git add`: - **does not save changes permanently** - **does not create a commit** - just marks changes that will go into the next commit --- ## Main use cases ### Add a single file ```bash git add index.js ``` --- ### Add all changes ```bash git add . ``` Adds: - new files - modified files - deleted files --- ### Add part of a file (interactively) ```bash git add -p ``` Allows you to: - choose specific changes (hunks) - make **logically clean commits** --- ### Add all files of a certain type ```bash git add "*.ts" ``` --- ## Frequent mistakes - Thinking that `git add` immediately makes a commit - Using `git add .` without checking `git status` - Adding `.env`, `node_modules`, build artifacts --- ## Relation to `git status` After `git add`: ```bash git status ``` Shows: - **Changes to be committed** - **Changes not staged for commit** --- ## Short version for an interview > `git add` **adds changes from the working directory to the staging area, preparing them for a commit.**For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.