This package is an adaptation of projectile-git-autofetch for the builtin package project.el. Thus, it is mostly identical. If anything, all credit goes to Andreas Müller.
With Emacs 30+
(use-package project-git-autofetch
:ensure t
:vc (:url "https://github.com/grolongo/project-git-autofetch"
:rev :newest))