Github facilitates open source collaboration. Wider then only the Mendix team server, where only team members of the project have access.
Also Github is designed for versioning/collaboration out of the box for whatever code you want to drop there. While the Mendix teamserver is wrapped around SVN especially for storage, versioning of & collaboration on the Mendix model and (static) resources.
Thus, Github is the way to go for widgets and non (direct) Mendix related JAVA code.
Mendix specific JAVA code -> teamserver as it is part of your model
The versions of Java actions and custom widgets are stored in the SVN Mendix version control.
However, these versions are not very accessible, but your history is save.