8

I just upgraded to the newest version of Magit having used the old version for years. All the improvements are great after a little searching around and figuring out the differences.

Now, I'm just trying to do the simplest (non-interactive) rebase in magit and I can't figure out how to do it. This example is from https://git-scm.com/docs/git-rebase.

git checkout topic
git rebase master
  1. Hit r
  2. ?
  3. My topic branch is rebased with the newest changes from master.
  • 2
    Choose "elsewhere", (press "e"), then from there choose "master". Just to make sure: you will be rebasing your branch "topic" on master (not from). On means Git will look for the youngest common ancestor of "master" and "topic", then work on the commits in "topic" to apply to them changes in "master". In the end, "master" will remain unchanged, but "topic" will incorporate changes from "master" (I'm writing this in hopes of preventing an error, that is if you thought that rebasing from master would do the opposite). – wvxvw Mar 22 '16 at 22:26
  • 2
    Note that if you set an upstream for your branch -- you can type b and then u repeatedly to cycle through known options (origin/master being typical) -- that will then become a default option to rebase onto (via r u). – phils Mar 22 '16 at 22:32
  • 3
    You should read magit.vc/manual/magit/Rebasing.html – phils Mar 22 '16 at 22:35
  • Thank for the comments. That did clear it up for me. I read through Magit's Rebasing page, but it wasn't making sense before. I think the word 'onto' was the problem. I'm now using 'r', then 'e' to merge the latest from master but knowing how to set my upstream with 'b', 'u' was helpful too. – Andrew Goodnough Mar 24 '16 at 16:42
  • @wvxvw could you please turn that comment into an answer? – tarsius Apr 13 '16 at 9:53
13
  1. Press r (rebase) in Magit status buffer. This will display a pop-up buffer with more options.
  2. Press e (elsewhere) to start rebasing on a different branch.
  3. Select the branch to rebase on by answering the prompt (note: the selected branch is not modified, the current branch is).
  4. The rebase process will start and you will now have more options in rebase menu: r to continue (after resolving conflicts), a to abort (the whole rebase process will be rewound back to before rebase) and s to skip (sometimes Git gets confused, for example, when your commit appears not to introduce any change, which may happen when your current branch and the target branch both added the same modification).
  5. Your commits will be applied to the commits in the target branch. If they don't apply smoothly, you will be shown the progress and the conflicts in the Magit status buffer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.