![Forrest logo](/images/logo.png)
git-add:tldr:3a6a8
The command "git add -i" is used to launch Git's interactive mode for adding changes to the staging area. It allows you to selectively choose which changes you want to add, instead of adding all changes at once.
By running this command, Git will present you with a menu, providing options for different types of changes you can interactively add. These options typically include:
- Patch - This allows you to choose specific changes from the diff to add.
- Update - This updates the index with the most recent changes from the working directory.
- Revert - This removes previously added changes from the index.
- Add untracked - This adds untracked files to the index.
- Patch untracked - This allows you to selectively choose specific changes from untracked files to add.
Once you select an option, Git will guide you through the process of interactively adding changes to the staging area.
Interactive mode is useful when you have multiple changes and want to carefully review and select which ones to add. It gives you more control and flexibility over the staging process, allowing you to split changes into separate commits or exclude certain modifications from being committed.