You have multiple libraries in .piolibdeps because you keep changing the lib_deps lines. You can delete the contents of .piolibdeps, and when you do the next build, PlatformIO will re-install the libraries configured in your platformio.ini lib_deps statement, giving you just the files that are needed.
commit stuff is outside of the scope of platformio. However, what you are looking for is the revert
git command… where you a new commit is added which rolls back prior commits to restore your code to a prior state.
https://git-scm.com/docs/git-revert
There is also the ‘reset’ command, which also rewinds back to a specified point, but it’s best to avoid that for now as you’ll really break stuff if you blindly use it.
You may find if you are playing with git and source control, that the GitLens extension is of help as it provides a much better graphical interface to GIT than the one bundled with VSCode.