git: Removing staged files before your commit

If you’ve staged more files than you intended with a ‘git add .’, if you haven’t committed yet you can selectively unstage files with:

git rm --cached path/filename

If you want to unstage multiple files in a folder, use the recursive flag

git rm --cached -r foldername/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.