git-add:tldr:23100
The command git add -p ${filename} in Git is used to add changes in a specific file interactively.
Here is a breakdown of the command:
-
git: It is the command for invoking Git, the version control system.
-
add: The add command is used to add changes to the staging area in Git.
-
-p: The -p flag stands for patch and is used to interactively add changes to the staging area. It allows you to review and select specific changes from a file before adding them.
-
${filename}: The ${filename} is a placeholder for the name of the file you want to add changes from. You replace it with the actual filename you want to interactively add changes for.
When you run this command, Git will show you each change made in the specified file, one by one, and prompt you for action. You have options to add the change to the staging area, skip the change, split the change into smaller parts, etc. This command is useful when you want to be selective about which changes to include in your commit.