I know there are sub trees and sub modules within GIT but i am still not sure which one would be the best option in my case.
So the situation is this:
So, the idea would be to be able to push "lib2" with its own history keeping all the rest of the project private. I know there are a lot of questions on this topic already but i wasnt able to find a clear answer.
You could leave the repository as it is and export this lib using:
git filter-branch --subdirectory-filer lib2
git help filer-branch
says:
--subdirectory-filter <directory>
Only look at the history which touches the given subdirectory.
The result will contain that directory (and only that) as its project root.
Developers of your project will not notice any change, because there is no change. - However updating that exported library would require you to run another filter-branch.