Attribute `groups`: List of groups to which this project belongs,
whitespace or comma separated. All projects belong to the group "all",
and each project automatically belongs to a group of its name:`name` and
path:`path`. E.g. for <project name="monkeys" path="barrel-of"/>, that
project definition is implicitly in the following manifest groups:
default, name:monkeys, and path:barrel-of. If you place a project in the
group "notdefault", it will not be automatically downloaded by repo. If
the project has a parent element, the `name` and `path` here are the
prefixed ones.
So when you do repo init with any AOSP branch, it will bring in all the needed repos to build images for particular target. But when you want to build SDK that's when you need those extra tools for which you need extra argument with -g in your repo init command.
If you do only -g tools then it will only sync repos for group "tools". That is why you need to specify -g all,-notdefault,tools to get everything needed to build images for target as well as SDK and any other add-ons.
Hope this helps.
--Nirav