I know this question has already got an accepted answer but maybe someone will come back to this and find it useful.
- I think tracking entire joomla and trying to exclude core files is almost impossible and as @vicgilbcn says it can become a nightmare.
- On the other hand if you are developing a component for J! which 'unfortunately' is slipt in 'components/com_mycomp', 'administrator/components/com_mycomp' and probably 'media/com_mycomp' you should have 3 separate git repos to track it - so this is not viable either.
So what I came up with and seems to be working quite well, is this:
Let's say I have a normal J! deloyment with my com_mycomp component inside.
- I create a folder outside of the joomla codebase and call it "COMMON".
- in "COMMON" I create a "joomla" folder
- in "COMMON/joomla" I create "myComp" folder which will hold entire codebase of my component
- in "COMMON/joomla/myComp" I use the Joomla folder structure and I MOVE(not copy) 'components/com_mycomp', 'administrator/components/com_mycomp' and 'media/com_mycomp' inside it.
- then i go back to where I removed the folders from and create symlinks to the new locations.
This way a can now create a git repository in COMMON/joomla/myComp.
Obviously, this environment should be a local development environment where you can adjust apache/php configuration, without security implications, to make this work. (I cannot recall if I actually had to do any special configuration modifications for this to work - if it doesn't check the logs...)
As a matter of fact, this solution does resolve another problem. Working this way you can actually symlink your component's codebase folders to two different Joomla deployments (a J!2.5.x and a J3.x.x for example) and be able to develop/check your component compatibiliy in an immediate way against different versions.