Horizontal genetic transfer (HGT) has played an important role in bacterial evolution at least since the origins of the bacterial divisions, and HGT still facilitates the origins of bacterial diversity, including diversity based on antibiotic resistance. Adaptive HGT is aided by unique features of genetic exchange in bacteria such as the promiscuity of genetic exchange and the shortness of segments transferred. Genetic exchange rates are limited by the genetic and ecological similarity of organisms. Adaptive transfer of genes is limited to those that can be transferred as a functional unit, provide a niche-transcending adaptation, and are compatible with the architecture and physiology of other organisms. Horizontally transferred adaptations may bring about fitness costs, and natural selection may ameliorate these costs. The origins of ecological diversity can be analyzed by comparing the genomes of recently divergent, ecologically distinct populations, which can be discovered as sequence clusters. Such genome comparisons demonstrate the importance of HGT in ecological diversification. Newly divergent populations cannot be discovered as sequence clusters when their ecological differences are coded by plasmids, as is often the case for antibiotic resistance; the discovery of such populations requires a screen for plasmid-coded functions.