Possible to update-ref remote repository?
- From
- Jesse Hopkins <jesse.hops@gmail.com>
- Date
- Sep 30, 2023, 16:34 UTC
- Message-ID
- <CAL3By--HowOL1ffKBPfmwnfUdJd4KXcnkpS2BgkbO=9E2WnHKw@mail.gmail.com>
Hello -
Wondering if it's possible to do the equivalent of the update-ref command remotely. Or I guess another way of putting it would be to git-push to a remote repository without needing a local clone of the repo.
Trying do something like:
git push <remote-repo-url> <sha1>:refs/heads/mybranchtoupdate
where I know that <sha1> already exists on the remote. I'd like to avoid the need to clone a local copy of the repo. Wondering if there might be some plumbing command(s) that could accomplish this?
Regards, Jesse
P.S. I think think a minimal way to do this using git push would be:
git init git remote add origin <remote-repo-url> git fetch origin <sha1>:refs/heads/mybranchtoupdate git push origin refs/heads/mybranchtoupdate:refs/heads/mybranchtoupdate
Seems that if it's known that <sha1> already exists on the remote, the fetch is unnecessary network overhead?