Ideally your git repository only contains code that you and your team wrote yourself by hand.
- 3rd party code should be included via a dependency manager (like composer)
- Generated files (like compiled stylesheets) should be excluded and be regenerated whenever needed (for example when you deploy your code to a server).
PackageStates.php contains the information which TYPO3 extensions are available and loaded in the system and is typically generated when you use the extension manager to (un)install extensions.