简体   繁体   中英

How do i git checkout multiple pr

I am new to github, there is a repo or library? that i am using, i would like to run some of the available PR that have not yet been merged into the branch i am running.

I fetched them all with

git fetch origin +refs/pull/ /merge:refs/remotes/origin/pr/

then pulled git checkout origin/pr/1282

this worked and the files changed in my folder, i then pulled another git checkout origin/pr/1275

The files from the first pull reverted. How do i test/ run multiple pr?

i also tried but failed with git checkout origin/pr/1293 origin/pr/1282 origin/pr/1287 origin/pr/1269

Thankyou

git checkout checks out a particular code version. you said,

then pulled git checkout origin/pr/1282

But you haven't pulled , you've checked out .

What you want to do is probably to check out a branch to work in,

git checkout -b my-merge-branch 

Then pull in the PRs you want:

git pull origin origin/pr/1293 origin/pr/1282 origin/pr/1287

Creating a new code version with all the changes from those refs.

我似乎已经通过使用git merge origin / pr / 1293 origin / pr / 1282 origin / pr / 1287使它正常工作

Another option if previous answer didn't work for you:

git remote add {the-repo} https://github.com/the/repo.git
git fetch --all && git checkout {the-repo}/{the-branch}

# Pull all PRs at once:
git pull --no-commit --squash -X theirs {the-repo} pull/3/head pull/5/head pull/7/head pull/9/head

# Or pull PRs one by one if all-at-one failed to merge:
git pull --rebase -X theirs {the-repo} pull/3/head
git pull --rebase -X theirs {the-repo} pull/5/head
git pull --rebase -X theirs {the-repo} pull/7/head
git pull --rebase -X theirs {the-repo} pull/9/head

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM