Module and theme in one directory?
Thanks to the suggestion of @kenorb, I have found a good way to solve this:

I init the git repository in drupal/, and I put  only the following line into .gitignore:

*


Then, I add (by force) my custom module and theme folders: 

$ git add -f sites/all/modules/custom
$ git add -f sites/all/themes/custom


With this, my repo still contains only my code and no Drupal modules. And this allows me even to track also my .htaccess, with:

$ git add -f .htaccess