- Southampton, England
Resetting Subdirectories in Git
How do you hard reset a subdirectory of a Git repository? Simple.
A word of warning. This replaces the working tree and the index with the HEAD commit.
Don't lose changes you might have already staged within the subdirectory. If this is the case and you wish to unstage those changes, use:
Think of git reset -- path
as the opposite of git add
.