Use git submodules/mercurial subrepositories as Paul S has suggested.
Following the best practises on https://www.mercurial-scm.org/wiki/Subrepository you would probably end up using 3 repos for your gear app:
- A repository containing the app related code
- One repo containg the "library" aka the commmon css/js
- One thin "shell" repo that only contains the "app" and the "library" repository
Using this approach you can develop the app and the library code independently.
If the library version evolves your shell repo still tracks the version that is guaranteed to work with your app repo as long as you don't decide to upgrade the lib.