sudodev
sudodev

Reputation: 353

Working on an old branch after pull request review

I made a pull request.
The reviewer requested a review.
In this time the main branch had a lot of modifications.
But now I have to edit a function that I don't have in my current branch (the pull request branch), because my branch is out to date.
How is the best way to get the code from the updated one for me to edit it?

Upvotes: 0

Views: 409

Answers (1)

vipulgupta2048
vipulgupta2048

Reputation: 313

If I understand your question, then what you want to do is pull the changes from the master branch into your pull request branch without messing up the changes that you have already done.

The Easy Way
git checkout <pull request branch>
git pull origin master
This will fetch all the changes from the master branch to your pull request branch and make a merge commit for it. After you have made the changes. You need to push your changes to the pull request branch. You can accomplish this by

git push origin <pull request branch>

The Best Way
Personally, I try to follow this since nobody really likes creating merge commits and it's just too much noise in the commit history, that you can easily avoid and help the team.

git pull --rebase

This wouldn't create a commit but isn't recommended if you have pushed your changes. And you need to solve the conflicts that comes next.

Hope this helps.

Upvotes: 1

Related Questions