Astrophysical stellar objects produce various energetic transients. For example, neutron star mergers produce short-duration gamma-ray bursts, core-collapse of normal stars produce supernovae, and core-collapse of massive metal-poor stars may produce long-duration gamma-ray bursts. Their different origins make their galactic and sub-galactic environments different. Neutron star mergers are usually from the faint region of old massive galaxies, while the core collapses of massive stars are usually from the bright region of young dwarf galaxies. I will present our work on the difference of their galactic and sub-galactic environments and the applications of the difference to identify the origin of new stellar transients.