Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pull changes from a pull request thats already checkout?

I have checked out a PR using:

git fetch origin pull/pull_req_ID/head:NEWBRANCHNAME

However, I can't pull changes to my local branch from that PR.

like image 976
mzz Avatar asked Oct 25 '25 14:10

mzz


1 Answers

If I understand the question correctly, another developer has pushed changes to a PR after you initially fetched it, and you want to get the latest updates. This should work:

git checkout NEWBRANCHNAME
git fetch origin pull/pull_req_ID/head
git rebase FETCH_HEAD  # Or git merge FETCH_HEAD

Bitbucket example:

git fetch origin pull-requests/101/from:pr/101
git checkout pr/101

# ...New changes pushed to PR #101 by another developer

git fetch origin pull-requests/101/from
git rebase FETCH_HEAD

Gitlab example:

git fetch origin merge-requests/101/head:mr/101
git checkout mr/101

# ...New changes pushed to MR #101 by another developer

git fetch origin merge-requests/101/head
git rebase FETCH_HEAD
like image 184
user321 Avatar answered Oct 27 '25 02:10

user321



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!