git rebase to _insert_ commits?

Misha Koshelev misha680 at gmail.com
Sat Jul 10 09:37:00 CDT 2010


On Sat, 2010-07-10 at 05:33 +0200, David Hedberg wrote:
> On Sat, Jul 10, 2010 at 2:54 AM, Misha Koshelev <misha680 at gmail.com> wrote:
> > Dear All:
> >
> > I am still learning git and it seems that my solution does not quite
> > work.
> >
> > Specifically, my idea was to use:
> > git rebase -i upstream/master
> >
> > Mark the commit _after_ which I'd like to insert a commit with edit.
> >
> > Then, when I am at that commit, I do:
> >
> > git commit --amend -a
> >
> > save commit
> >
> > Then, _before_ doing git rebase --continue, I edit files and again do:
> >
> > git commit -a -n
> >
> > Finally I do:
> >
> > git rebase --continue
> >
> > The problem is that this seems to squish further commits, and leads to
> > problems which I am now trying to untangle.
> >
> > However, as I still cannot insert a commit, I am not sure how to
> > proceed, except by creating a whole new repository.
> >
> > Any ideas/hints?
> >
> 
> I might have misunderstood what you want to do, but you should be able
> to simply mark the commit _before_ for editing, make any changes and
> commit them normally (without using --amend) before finally doing a
> rebase --continue. This should insert a new commit with your changes
> right after the one you marked "edit".
Thank you. I will try this next time.

Perhaps why I was having problems was because I was doing the
opposite...

i.e.:

mark the commit itself for editing
make changes and do commit --amend
now make a new commit using commit without amend
finally doing rebase --continue

I think your suggestion is to:

mark the commit before for editing
make some changes and do commit
then rebase --continue

Actually that's even better because then the second commit seems like it
will get adjusted automatically (i.e., I don't have to manually split it
as it will only commit the differences that are still _unchanged_).

Wonderful. Thank you
Misha

> 
> Another thing I've found helpful is rebase --abort :-)
> 
> > Thank you
> > Misha
> >
> >
> >
> >
> 
> David





More information about the wine-devel mailing list