Tag git

 Reply

If you run env GIT_SSH_COMMAND='ssh -vvv that'll give you the verbose output you'll need from ssh to do it πŸ‘πŸ½

 Reply

https://www.jvt.me/posts/2021/03/31/git-origin-head/ may be of interest as a fairly well supported way of getting upstream default branch - I'm interested in this too though so I'll have a play with it tomorrow too

 Reply

Have you looked at git reflog? It shows a log of all operations on your local repo and allows you to do exactly that - find commit hashes to go back to, which you could then git reset --hard

 Reply

A number of Git hosting tools (GitLab and GitHub at least) use origin/HEAD to denote primary branch on the upstream so you could probably do something with that

 Reply

I don't think so but https://github.com/forgefed/forgefed is a standard that's being worked on to make it possible to federated across providers for this reason