why git reset --hard doesn't work in commit code example
Example 1: git reset
git reset --soft HEAD~3
git commit
git push —force-with-lease origin
Example 2: git reset hard directory
git restore --source=HEAD --staged --worktree -- aDirectory
# or, shorter
git restore -s@ -SW -- aDirectory