git can I view the reflog of a remote?

后端 未结 3 1255
栀梦
栀梦 2020-11-27 17:37

Is it possible to view the reflog of a remote? That is, I want to know what the output of git reflog is on another remote machine.

Note, I am not asking

3条回答
  •  时光取名叫无心
    2020-11-27 18:00

    On the off chance that the remote machine is a github repository,

    1. First use Github’s Events API to retrieve the commit SHA.
      curl https://api.github.com/repos///events

    2. Identify the SHA of the orphan commit-id that no longer exists in any branch.

    3. Next, use Github’s Refs API to create a new branch pointing to the orphan commit.

      curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"ref":"refs/heads/D-commit", "sha":""}' https://api.github.com/repos///git/refs

      Replace in the above command with the SHA identified in step 2.

    4. Finally git fetch the newly created branch into your local repository.
      From there you can cherry-pick or merge the commit(s) back into your work.

    Check out this article for an actual example.

提交回复
热议问题