Easy enough to repair.
Useful things to have:
A powerlink (a special chain link that can be used to join a chain without needing any tools)
A chain tool (from any bike shop or online retailer) or, most multitools (tools to take with you on a ride for minor adjustments/repairs) include a chain tool some of which are good quality.
Some spare chain links
To fix:
If there are any twisted links, they’ll need to be removed using the chain tool.
Then add (if you have any*) enough spare links to make up for the damaged ones you have removed, again using the chain tool. You’ll need to end up with an undamaged inner link on one end of the chain. If you have a powerlink you’ll need an inner link at the other end too; if not, it needs to be an outer link.
Make sure the chain is threaded through both mechs correctly. Take some tension off by dropping the chain off the front chainring.
If using a powerlink, fit it. If not, use the chain tool again.
Ride off.
*If you don’t have any spare chain links you can usually get away with a missing link or so but you need to ensure you never shift into large/large.
Golden rules:
If the chain breaks a second time, replace it.
Do not expect a chain ‘repaired’ with pliers/hammers/rocks in the absence of a chain tool to last very long