If you want to ensure that all your files are formatted, enable the setting editor.formatOnSave in VS Code. For information about configuring your settings, see User and Workspace Settings in the Visual Studio Code docs.

If you want to format your files each time that you commit changes to your Git repository, set up a Git hook.