You can use git hooks to achieve what you want. Of course, you can use pre-commit to rename the .git directory of your included project, for example. to ".git2", add all the files to the last project except the ".git2" directory, copy everything, click and finally use the post-commit hook to rename the ".git2" folder back to ".git" in your module .
1) Create a pre-commit file under the .git / hooks / of your root account with the contents:
#!/bin/sh mv "vendor/modulename/.git" "vendor/modulename/.git2" git rm --cached vendor/modulename git add vendor/modulename/* git reset vendor/modulename/.git2
2) Create a post-commit file under .git / hooks / also with the contents:
#!/bin/sh mv "vendor/modulename/.git2" "vendor/modulename/.git"
3) Change the file in your repo and finally
git commit -a -m "Commit msg" git push
source share