A few days ago, this utility was published: https://github.com/geongeorge/Git-User-Switch
After reading the comments and seeing multiple alternatives, I tried to Rewrite it in Rust. In comparison with the original, this one does not depend on Yarn/JS and can be used by downloading a single binary:
https://github.com/cquintana92/git-switch-user