How to get certain commit from GitHub project

后端 未结 11 1217
名媛妹妹
名媛妹妹 2020-12-07 07:27

I need to download the Facebook API from GitHub. Normally, I just click on the \'Downloads\" tab to download the latest source code. In this case, I need an older commit: 91

相关标签:
11条回答
  • 2020-12-07 07:51

    Sivan's answer in gif

    1.Click on commits in github

    2.Select Browse code on the right side of each commit

    3.Click on download zip , which will download source code at that point of time of commit

    0 讨论(0)
  • 2020-12-07 07:52

    To just download a commit using the 7-digit SHA1 short form do:

    Working Example:

    https://github.com/python/cpython/archive/31af650.zip  
    

    Description:

     `https://github.com/username/projectname/archive/commitshakey.zip`
    

    If you have the long hash key 31af650ee25f65794b75d4dfefed6fe4758781c1, just get the first 7 chars 31af650. It's the default for GitHub.

    0 讨论(0)
  • 2020-12-07 07:52

    If you want to go with any certain commit or want to code of any certain commit then you can use below command:

    git checkout <BRANCH_NAME>
    git reset --hard  <commit ID which code you want>
    git push --force
    

    Example:

     git reset --hard fbee9dd 
     git push --force
    
    0 讨论(0)
  • 2020-12-07 07:57

    The easiest way that I found to recover a lost commit (that only exists on github and not locally) is to create a new branch that includes this commit.

    1. Have the commit open (url like: github.com/org/repo/commit/long-commit-sha)
    2. Click "Browse Files" on the top right
    3. Click the dropdown "Tree: short-sha..." on the top left
    4. Type in a new branch name
    5. git pull the new branch down to local
    0 讨论(0)
  • 2020-12-07 08:00

    The question title is ambiguous.

    • If you need to get a commit, just use this URL: https://github.com/facebook/facebook-ios-sdk/commit/91f256424531030a454548693c3a6ca49ca3f35a.patch (like explain here for the question How to download a single commit-diff from GitHub?)
    • if you need to download the entire project at the commit you need, use this URL: https://github.com/facebook/facebook-ios-sdk/archive/91f256424531030a454548693c3a6ca49ca3f35a.zip
    • if you need the git revision log, clone the repository and checkout the commit you want.
    0 讨论(0)
  • 2020-12-07 08:04

    Try the following command sequence:

    $ git fetch origin <copy/past commit sha1 here>
    $ git checkout FETCH_HEAD
    $ git push origin master
    
    0 讨论(0)
提交回复
热议问题