Bringing a customised template back under version control means extracting the content before deleting the post.
# extract, commit, then reset
$ wp post get "$id" --field=content > templates/single.html
$ git add templates/single.html && git commit -m 'adopt editor changes'
$ wp post delete "$id" --force
# and the check that nothing else drifted:
$ wp post list --post_type=wp_template --format=count
0
Doing this as a routine rather than an incident is what keeps a block theme deployable — a site with eleven customised templates is a site where the repository describes nothing. The count being zero is the assertion, and running it in a deploy script turns a silent divergence into a refusal.