Forrest logo
back to the git tool

git-stage:tldr:af769

git-stage: Interactively stage a file.
$ git stage -i
try on your machine

The correct command is "git add -i" not "git stage -i".

"git add -i" is a command in Git that initiates the interactive mode to selectively stage changes in the working tree for the next commit. It allows you to review modified files and choose which changes to include in the commit.

When you run "git add -i", Git presents a menu of options such as "status", "update", "add untracked", "patch", etc. These options allow you to browse and select specific changes or files to stage. You can review the changes, mark them for staging, and even split hunks of changes into smaller parts if needed.

This interactive mode is useful when you have multiple changes in different files, and you want to make granular commits instead of committing all the changes at once. It gives you more control over what gets included in each commit.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the git tool