git add --put the file ready for commit

Use the "git add" command to put the file ready for commit.

# Put one file ready for commit
git add filename

# Put all files under the current directory ready for commit
git add.

What is commit preparation?

In Git, you need to prepare for a commit before you can commit. The "git add" command is a command to put a file ready for commit. It may be explained that you put it in the cache or put it in a staging state, but this site uses the term commit preparation.

How to check the commit preparation status?

Use the " git status" command to check the commit readiness.

git status

How to cancel the commit preparation status?

If you accidentally put a file in the ready-to-commit state, you may want to cancel the ready-to-commit state.

Uncommit ready for a specific file

Use "git rm --cached" to uncommit a particular file.

# Release the ready-to-commit state for a specific file
git rm --cached filename

Uncommit ready status for all files

Use the "git reset" command to uncommit all files.

# Uncommit ready for all files
git reset

If you make a mistake, don't run "git reset --hard" to uncommit all files. Running "git reset --hard" will also bring back any changes made in the working directory.

Associated Information