Paul Smith <[email protected]> writes:

> Fairly often I find myself wanting to split commits when I do
> interactive rebasing and I'm wondering if anyone has hints for how to
> handle this more easily using Magit.
>
> What I do today is invoke interactive rebase from Magit and mark the
> commit I want to split with "e" (edit).

If the only operation you want is split one commit, you can also call
magit-rebase-edit (r m), which lets you avoid the git-rebase-todo step.

> When Magit stops, I open a shell and run git reset HEAD~, then I go
> back to Magit and use it to add the bits I want to make the new
> commit(s).

As Ben mentions, 'x' then "HEAD~" gets you to the same place.

> Often I want to use some form of the original commit message when I
> create the extra commits, so I also have to go spelunking to get a
> copy of the "under edit" commit message and paste it in.

After a reset operation, ORIG_HEAD points to the commit you just left.
>From the commit popup, you reuse its message by hitting '=C' and
selecting ORIG_HEAD from the completion candidates.

That won't give you a chance to edit the commit message.  If you want to
do that, start the commit as usual ('c c') and then call
git-commit-prev-message ('M p').

> Are there Magit features that will make this simpler for me, that I
> just don't know about?

Hopefully the one I suggested do.

> Things that would be nice:
>
>  * Automatically do the reset operation.  I can't come up with the
>    right Magit "reset" operation for this.  Is there a simple way to
>    run the "git reset HEAD~" operation, or a shortcut?  Could there be
>    a mode in interactive rebase that would to this, some kind of
>    "split" operation or something instead of just "edit"?  I guess that
>    requires a new feature in Git itself.

I like the idea of wrapping the rebase and reset operations into one
command.  I think it's a common operation, and I personally would use it
a lot.  It's worth a feature request on GitHub to see what others think.

>  * Automatically insert the commit message from the commit I'm editing,
>    when I make a new commit.  Or some command that will let me easily
>    yank that message and start editing it.

Magit already has this covered with =C and git-commit-prev-message, I
think.

>  * Maybe something that does something smart if I "r r" (continue) when
>    there are still files modified or staged.  I'm not sure about this
>    one.

I'm not sure about that one either :)

-- 
Kyle

-- 
You received this message because you are subscribed to the Google Groups 
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to