Minecraft wiki entry for Anvil_mechanics, associated text: Item repair on a crafting grid removes all prior work penalties, and also removes any enchantments. If a grindstone is used, the item keeps its custom name but loses its enchantments and prior work penalties, and some XP from enchantments can be reclaimed.