i use git with CubeMX project in eclipse w/o any problem , external tool are not necessarly required ( maybe just simpler).
how to do it all in eclpise
have your project Generated by CubeMX (do not use option to link all file but instead copy all or only require file to project)
in eclipse create a new project with new -> project - (generic project )
in the dilaog
untick “default location”
give the project a name
then browse to the CubeMX top tree folder
et git it
Now project-> team ->Share
to keep git repo on the same place/ folder tick “use or create repository in praent folder of project ”
in dialog bottom use “create”
voila ... all done , commit everyhing straigh away (select all files)
Now you can import the ac6 proejct from the source tree in git repo view (import existing prioject)
if gire repo view is not visible “window ->show view ->other -> git -> repo ...”
Take care eclispe easily mess up if you open the same file mutliple time (ie the one from the top project and the same linked from ac6 project).
to avoid that simply close or delete( just from explorer view do not delete from file system) top project
note thay under window Mysgit or some mingw-msys package ( https://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/) provide git/svn/... command line .
if you want to keep include form an example cube (not cubemx) project it is not so easy/possible as all project link files to the same local library source , so it woudl require to version everything to get include (and all drivers midleware etc source as well)