Bacteria drive crucial processes across ecosystems and profoundly impact human health, yet tools to rewrite microbiomes remain limited. Here, we show that bridge recombinase enables versatile and programmable genome editing across the bacterial tree of life. In Escherichia coli, we achieved 142 kb insertions at >90% efficiency, megabase-scale inversions (2.3 Mb), and pathway-scale 50 kb excisions. With a single ortholog and bridge RNA (bRNA), we edited bacterial isolates spanning five phyla and performed metagenomic editing in human gut microbiomes. We overcame cross-reactivity between co-expressed bRNAs to establish single-step search-and-replace editing, and demonstrated capture and interphylum transfer of functional chromosomal pathways, enabling programmable horizontal gene transfer. These advances establish bridge recombinase as a foundation for orchestrating controlled gene flow in complex microbial ecosystems.