Home > Blockchain >  What it mean when your pull request is okay but are asked to "rebase this on master?" Afte
What it mean when your pull request is okay but are asked to "rebase this on master?" Afte

Time:03-23

Your pull request is approved by someone with write permissions, and they respond "can you rebase this on master? I'll merge it after."

What would be the steps using git, if that simplifies things. Or any step involving Visual Studio and even GitHub Desktop.

  • git rebase master
  • git commit -m "rebased to master"
  • git push

Is that what he meant? And why would my fork need to be rebased? I can't possibly rebase his repo.

CodePudding user response:

You must first to reference the target repository, assuming your PR comes from a fork:

cd /path/to/local/cloned/fork
git remote add upstream https://github.com/original/repository
git fetch upstream

Then you can rebase on top of the updated target branch (master) from the target repository (upstream)

git switch my_pr_branch
git rebase upstream/master
git push --force

Assuming you are the only one working on the PR, the push --force is not dangerous, and will update your PR.

The end goal is to allow the maintainer of the target repository to do a trivial merge of your PR branch to master: trivial because all your PR commits will have been added on top of master, there is no more merge conflicts.
Any merge conflicts were resolved locally, by you, during the rebase.

  • Related