I made changes to some of my files in my local repo, and then I did git add -A
which I think added too many files to the staging area. How can I delete all the
use
git reset HEAD
This will remove all files from staging area
The best way to undo your file which is already there in the staging area is git reset --hard which brings your staged files to back. Careful now, that will remove staged and unstaged changes.
It is very simple:
To check the current status of any file in the current dir, whether it is staged or not:
git status
Staging any files:
git add .
for all files in the current directory
git add <filename>
for specific file
Unstaging the file:
git restore --staged <filename>
Use
git reset
to unstage all the staged files.
You could use
git reset HEAD
then add the specific files you want with
git add [directory/]filename
You can reset the staging area in a few ways:
Reset HEAD and add all necessary files to check-in again as below:
git reset HEAD ---> removes all files from the staging area
git add <files, that are required to be committed>
git commit -m "<commit message>"
git push