How can I pull down a commit from Github (Enterprise) that I don't have locally?

前端 未结 3 616
滥情空心
滥情空心 2021-02-05 19:46

I accidentally did a push --force on the wrong repo (too many termminals open), effectively resetting the master branch back to an earlier commit.

Looking a

3条回答
  •  忘掉有多难
    2021-02-05 19:55

    You can create a branch from an orphaned commit in the Github GUI by doing the following:

    1. Browse to https://github.com/yourOrg/yourRepo/tree/commitHash
    2. Click on the branch dropdown
    3. Type in the new branch name and hit Enter

    Now that you have a branch, you can use your Git client to check it out as normal.

    Notes

    This post was helpful as I researched this. It basically states that you are stuck unless you have a local repository containing the orphaned commits. My approach allows you to add a branch so the commit is no longer orphaned.

提交回复
热议问题