Search code examples
gitgit-rebase

Is it possible to do a git-rebase instead of doing a git-pull


I started to rewrite some of the Perl programs from the NASM source files. I have already done a few commits to my own working copy, and I was wondering if, instead of doing git pull, I should have been doing git rebase.

I have pretty much decided that I should have been doing a git rebase, but I don't know how to rework my repository to achieve that effect, or even if it is possible.

Screenshot-gitk: nasm.crop


Solution

  • It is possible, and the Git Magic tutorial will explain how to do it. But if anyone else has seen your branch, it is unsafe. Even if nobody else has seen your branch, let me urge you to reconsider.

    Why have rebasing? Why not just pull/merge?

    The purpose of rebasing is to rewrite history so that your repository reflects the way you believe your software should have evolved instead of the way it actually did. When is this important? When you are a junior member of a distributed development team, and you don't have commit privileges—instead, all you can do is submit patches to a gatekeeper and hope that they are accepted. To maximize the chances of acceptance, you want to rewrite history to make your patches as clean and clear as possible. Is the development model sounding familiar?

    Manoj Srivastava has written a fairly thoughtful analysis of rebase-vs-merge.