The following sequence of steps teaches you how to move ROS packages from one (e.g. private) into another (e.g. public) repository while preserving the history at the same time.
git filter-branch -f --tree-filter 'find . -maxdepth 1 -not -name . -a -not -name cool_package_name -a -not -name .git -exec rm -r {} \;'
The above command basically removes in every revision everything but the directories .git and cool_package_name.