@@ -518,7 +518,7 @@ will raise an error:
518518 hint: Updates were rejected because the tip of your current branch is behind
519519 hint: its remote counterpart.
520520
521- This is a sane behavior, Git will not let you push changes that would
521+ This is reasonable behavior, Git will not let you push changes that would
522522override remote content. But that's actually what we want to do here, so we
523523will have to *force * it:
524524
@@ -530,6 +530,31 @@ And tadaa! Git will happily *replace* your remote branch with what you had
530530locally (so make sure that's what you wanted, using ``git log ``). This will
531531also update the PR accordingly.
532532
533+ Rebasing onto another branch
534+ ----------------------------
535+
536+ If you have accidentally opened your PR on the wrong branch, or need to target another branch
537+ for some reason, you might need to filter out a lot of commits that differ between the old branch
538+ (for example ``4.2 ``) and the new branch (for example ``master ``). This can make rebasing difficult
539+ and tedious. Fortunately ``git `` has a command just for this situation, ``git rebase --onto ``.
540+
541+ If your PR was created from the ``4.2 `` branch and you want to update it to instead start at ``master ``
542+ the following steps *should * fix this in one step:
543+
544+ .. code-block :: text
545+
546+ $ git rebase -i --onto master 4.2
547+
548+ This will take all the commits on your branch *after * the ``4.2 `` branch, and then splice them on top of ``master ``,
549+ ignoring any commits from the ``4.2 `` branch not on the ``master `` branch. You may still need to do some fixing, but
550+ this command should save you a lot of tedious work removing commits.
551+
552+ Just like above for the interactive rebase you need to force push your branch to handle the different changes:
553+
554+ ::
555+
556+ $ git push --force origin better-project-manager
557+
533558Deleting a Git branch
534559---------------------
535560
0 commit comments