Forrest logo
back to the git tool

git-add:tldr:9c216

git-add: Only add already tracked files.
$ git add -u
try on your machine

The command git add -u is used to update the Git index with the changes made to files that are already being tracked by Git.

Here's a breakdown of what each part of the command means:

  • git add: This is the basic Git command used to add changes to the staging (or index) area.
  • -u: This is a shorthand option which stands for --update. It tells Git to only add the changes made to already tracked files, but not to add new untracked files.

When you run git add -u, Git scans the working directory for any modifications to the files that are already being tracked by Git. It will add these changes to the staging area so that they can be committed in the next step.

It's worth noting that this command only includes modifications to already tracked files and doesn't consider new or untracked files. If you want to include both modifications and new files, you can use git add -A instead.

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