Provided is a lithium or sodium metal battery having an anode, a cathode, and a porous separator and / or an electrolyte, wherein the anode contains a graphene-metal hybrid foam composed of multiple pores, pore walls, and a lithium- or sodium-attracting metal residing in the pores; wherein the metal is selected from Au, Ag, Mg, Zn, Ti, Na (or Li), K, Al, Fe, Mn, Co, Ni, Sn, V, Cr, or an alloy thereof and is in an amount of 0.1% to 90% of the total hybrid foam weight or volume, and the pore walls contain single-layer or few-layer graphene sheets, wherein graphene sheets contain a pristine graphene or non-pristine graphene selected from graphene oxide, reduced graphene oxide, graphene fluoride, graphene chloride, graphene bromide, graphene iodide, hydrogenated graphene, nitrogenated graphene, doped graphene, chemically functionalized graphene, or a combination thereof.