Gamma-ray bursts (GRBs) are cosmologically distributed, very energetic and very transient sources detected in the gamma-ray domain. The identification of their x-ray and optical afterglows allowed so far the redshift measurement of 150 events, from z = 0.01 to z = 6.29. For about half of them, we have some knowledge of the properties of the parent galaxy. At high redshift (z > 2), absorption lines in the afterglow spectra give information on the cold interstellar medium in the host. At low redshift (z < 1.0) multi-band optical-NIR photometry and integrated spectroscopy reveal the GRB host general properties. A redshift evolution of metallicity is not noticeable in the whole sample. The typical value is a few times lower than solar. The mean host stellar mass is similar to that of the Large Magellanic Cloud, but the mean star formation rate is five times higher. GRBs are discovered with gamma-ray, not optical or NIR, instruments. Their hosts do not suffer from the same selection biases of typical galaxy surveys. Therefore, they might represent a fair sample of the most common galaxies that existed in the past history of the universe, and can be used to better understand galaxy formation and evolution.