Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git rebase after pull request

I have trouble to update a pull request.

What I did: forked a repository, cloned it locally, created a branch (pr-branch) that tracks upstream/master, committed some changes, pushed to origin, opened a pull request.

Now I need to update my pull request but changes have been made by other devs on upstream/master.

So I did :

  • git checkout -b master-updated upstream/master
  • git pull
  • git checkout pr-branch
  • git rebase master-updated

I was going to make some changes but git/source tree tells me that origin/pr-branch and pr-branch have diverged : 126 ahead and 1 behind

(I did some rebase before but never saw (or paid attention :-)) this kind of message...)

What I am supposed to do next ?

Make changes, commit then push to origin ? Pull (but create a merge commit I guess), commit then push to origin ?

Thanks!

like image 742
Anthony G Avatar asked Feb 06 '23 19:02

Anthony G


1 Answers

Make changes, commit then push to origin ?

Yes, but the push would be a forced one:

git push --force

The goal is to replace the remote history of your pr branch by the local one (rebased on top of the updated upstream master)

126 ahead and 1 behind (I did some rebase before but never saw (or paid attention :-)) this kind of message...)

That seems expected after a rebase: the local and remote history are no longer the same.

like image 175
VonC Avatar answered Feb 08 '23 09:02

VonC