Contacts Dedupe
read_when:
- Finding duplicate Google Contacts.
- Reviewing or changing
gog contacts dedupe.
gog contacts dedupe finds likely duplicate personal contacts and prints a merge plan. Preview is the default; --apply performs the reviewed plan.
#Command Page
#Basic Use
gog contacts dedupe
gog contacts dedupe --json
gog contacts dedupe --max 500 --json
Default matching uses normalized email and phone values:
gog contacts dedupe --match email,phone
Name matching is opt-in because it can produce false positives:
gog contacts dedupe --match email,phone,name
#Apply A Merge
Review the plan first:
gog contacts dedupe --json
Then inspect the exact mutation plan without changing contacts:
gog contacts dedupe --apply --dry-run --json
For automation, copy the contact resource names from the reviewed preview and scope both dry-run and apply to that exact set:
gog contacts dedupe \
--resource people/123 \
--resource people/456 \
--apply \
--dry-run \
--json
Apply interactively:
gog contacts dedupe --apply
Non-interactive automation must explicitly skip confirmation:
gog contacts dedupe \
--resource people/123 \
--resource people/456 \
--apply \
--force \
--json
#Output
The command groups contacts that share a matching key. JSON output includes:
scanned: number of contacts examinedgroups: likely duplicate groupsprimary: the contact gog would keep first in a hypothetical merge planmerged: merged emails/phones for previewmatched_on: duplicate email/phone/name keys that caused the groupmembers: all contacts in the group
Applied output also includes:
applied: whether mutations rangroups_merged: groups completedcontacts_deleted: redundant contacts deletedupdate_fields: People API fields unioned into the primary contactdelete: redundant contacts removed after their data was copied
#Safety
contacts dedupe remains read-only unless --apply is present. Apply mode:
- requires confirmation unless
--forceis present - honors
--dry-run - supports repeatable
--resourcescoping so automation can apply an exact - reads contact-source data only
- refreshes each contact before planning
- updates the selected primary before deleting anything
- rechecks each redundant contact's etag immediately before deletion
- refuses groups with conflicting singleton fields (
names,birthdays, - refuses secondary contacts with photos or other fields the People API cannot
reviewed contact set
biographies, or genders)
preserve through updateContact
The People API does not expose Google Contacts' native merge operation. gog therefore unions all API-updatable fields into the selected primary, then deletes redundant contacts sequentially. If a request fails, the command stops and reports completed groups/deletions; copied data remains on the primary and undeleted contacts remain intact.
Use --fail-empty in scheduled checks when "no duplicates" should be reported as a distinct exit code:
gog contacts dedupe --fail-empty