Git merge remote pull requests on local clone

I am trying to grade assignments submitted to a git repository in the form of pull requests. Each pull request is one student's submission. There is only one branch in this repo that holds the assignment prompt. (I don't have write access to this repo.)

How would I go about testing each of these pull requests on my local machine? I have tried something like the following:

  • I cloned the master branch using the GUI on github.com
  • I tried the instructions in this article entering the following in the gitbash terminal:

    $ git checkout -b [student-alias]    
    $ git fetch origin pull/1/head:[student-alias] --update-head-ok
    
  • The fetch:

    $ git fetch origin pull/1/head:[student-alias] --update-head-ok
    
  • gives me the following error:

    remote: Counting objects: 61, done.
    remote: Compressing objects: 100% (4/4), done.
    remote: Total 61 (delta 21), reused 20 (delta 20), pack-reused 37
    Unpacking objects: 100% (61/61), done.
    From https://github.com/repo-name
    ! [rejected]
    refs/pull/1/head -> [student-alias] (non-fast-forward)


    If you just want to test each branch than

    git fetch origin [student-alias]
    git checkout origin/[student-alias]
    

    would allow you to set your working directory into the current state of each branch [student-alias]

    If you want to checkout the state of the pull request (which usually on github does not differ from the most recent version of the branch it is coming from unless merged), then I suggest following the tutorial you linked (without the not mentioned --update-head-ok and go with

    git fetch origin pull/[pull-request-id]/head:[student-alias]
    git checkout [student-alias]
    

    The difference between these two is, that one works on a branch at the other on the pull request (which is a github feature).

    链接地址: http://www.djcxy.com/p/23180.html

    上一篇: 在Mailgun消息Django / Python中附加生成的PDF

    下一篇: Git合并本地克隆上的远程拉取请求