Based on the merge rules, the merge batch job eliminates duplicate records. You can create or modify merge rules for accounts, contacts, leads, and person accounts.
To update the field for which you want to configure a merge rule irrespective of whether the master record value is null or not null, use the following code in the Salesforce Developer Console:
DSE.API_SettingsManager.updateInternalSetting('Update master if null', 'false');