git add -i

Interactively add files to the git index

This command allows you to interactively choose which files you want to add to the git index. It presents a menu that lets you select specific files or apply actions to groups of files, such as adding all files with a specific extension. You can also split hunks within a file and choose which changes to stage.

-i is the short version of the --interactive flag.

Some variations of this command include:

  • git add --patch (-p): The same as git add -i, but instead of using a menu, it interactively prompts you for each individual change within a file.
  • git add --edit: This opens up the default text editor to manually modify the list of files to be added in an interactive manner.