Raspberry Pi Zero 12V Battery backup to 5V - do I need the resistor?
The two diodes (D2 &amp; D3) work to OR the voltages, the idea being your 12V_IN will be slightly higher than 12V_BATTERY, so current will flow from 12V_IN to power the device when its present... Minus a diode drop.

When 12V_IN is removed current will flow from 12V_BATTERY through D3

R1 is probably there to act as a current limiting resistor for charging the battery.

So this is basically a UPS for your PI. 

The battery will charge to (12V_IN - Vfwd D2) Need to ensure 12V_IN is at the correct level to charge your battery and not destroy any connected circuitry.