Interactive git-rebase

Hi all,

This will only be possible on git 1.5.3 and later versions (1.5.3 is the most recent at the time of this posting). With interactive rebase you can reorder your commits, meld them together, discard some commits, etc...

Let's see how to do it.

Story: You have 2 branches: master and exp. On exp you have a lot of dirty commits. But you wanna prepare a nice patch series for sending it away.

The best way to do it, would be to rebase exp branch with interactive flag.

When you first run:

$ git-rebase -i master

on your exp branch, you'll see a message like this one:

# Rebasing db582d7..113a448 onto db582d7
## Commands:
#  pick = use commit
#  edit = use commit, but stop for amending
#  squash = use commit, but meld into previous commit
## If you remove a line here THAT COMMIT WILL BE LOST #
pick 379b255 PATCH 1: blablabla
pick f115715 PATCH 2: blablablapick 113a448 Rebase

As you can see, we have 3 commands, but 4 actions to take.

pick will use the commit the way it is.
edit will use the commit but let you amend anything to it
squash will use the commit, but meld into the previous one

And the other action would be removing that line and LOOSING that commit.

You can also reorder the lines and produce another patch series...

Anyway, it's up to your imagination..

See y'all

VN:F [1.9.0_1079]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.0_1079]
Rating: 0 (from 0 votes)

Leave a Reply