Non-abelian gauge theories in the context of generalized complex geometry are discussed. The generalized connection naturally contains standard gauge and scalar fields, unified in a purely geometric way. We define the corresponding Yang-Mills theory on particular subbundles of a Courant algebroid, known as Dirac structures, where the generalized curvature is a tensor. Different Dirac structures correspond to different known theories, such as the bosonic sector of maximally supersymmetric Yang-Mills in ten and four dimensions and reduced matrix models. Furthermore, we revisit the non-abelian world volume effective action of D-branes in this formalism, where the gauge field on the brane and the transverse scalars are unified, while the action does not contain pullbacks of fields and its consistency with T-duality is verified at face value.