# Possible git bug

3 messages from 2013-08-14 to 2013-08-14. Participants: Hugh Davenport, Daniel Knittl-Frank, Jeff King.
Thread: https://gitlist.dev/t/34690

## Hugh Davenport, 2013-08-14 04:50

Subject: Possible git bug
Message-ID: <9c9e5ea8a9d7e8ef37201cfb8ca9dcc3@davenport.net.nz>
URL: https://gitlist.dev/e/9c9e5ea8a9d7e8ef37201cfb8ca9dcc3%40davenport.net.nz

```
Hey,

Not sure if this is a bug or not. I commonly am finding myself wanting 
to
remove some recent commits, either all or just a select few. So I use 
rebase
in interactive mode for this. The problem I find is that when I do a 
rebase
and leave no commits to pick (where I would think that this would do the 
same
as a reset --hard) just tells me that there is nothing to be done.

So would that be a bug? Or maybe a feature? I would like it that when 
you do
a rebase and select no commits, it will rebase ontop of the commit you 
chose,
and remove all the commits not shown in the interactive listing (so 
all).

Any ideas are welcome.

Cheers,

Hugh

```

## Daniel Knittl-Frank, 2013-08-14 05:42

Subject: Re: Possible git bug
Message-ID: <CACx-yZ3Ba2vU4Jhjdtp1Ko=VjwarDkdHtN7ZFCzrU9Pz7-+S_Q@mail.gmail.com>
URL: https://gitlist.dev/e/CACx-yZ3Ba2vU4Jhjdtp1Ko%3DVjwarDkdHtN7ZFCzrU9Pz7-%2BS_Q%40mail.gmail.com
In-Reply-To: <9c9e5ea8a9d7e8ef37201cfb8ca9dcc3@davenport.net.nz>

```
On Wed, Aug 14, 2013 at 6:50 AM, Hugh Davenport <hugh@davenport.net.nz> wrote:
> Hey,
>
> Not sure if this is a bug or not. I commonly am finding myself wanting to
> remove some recent commits, either all or just a select few. So I use rebase
> in interactive mode for this. The problem I find is that when I do a rebase
> and leave no commits to pick (where I would think that this would do the
> same
> as a reset --hard) just tells me that there is nothing to be done.

This is left as a way to abort a rebase if you change your mind just
before actually executing it. This also works parallel to committing
with an empty commit message.

> So would that be a bug? Or maybe a feature? I would like it that when you do
> a rebase and select no commits, it will rebase ontop of the commit you
> chose,
> and remove all the commits not shown in the interactive listing (so all).

You can just use `git reset --hard <commit to rollback to>`  to
discard all commits after the given commit (Unless they're part of
another branch, of course). `git reset --soft` if you want to keep the
state of your current working directory.

Cheers,
Daniel

-- 
typed with http://neo-layout.org

```

## Jeff King, 2013-08-14 06:53

Subject: Re: Possible git bug
Message-ID: <20130814065339.GA3744@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20130814065339.GA3744%40sigill.intra.peff.net
In-Reply-To: <CACx-yZ3Ba2vU4Jhjdtp1Ko=VjwarDkdHtN7ZFCzrU9Pz7-+S_Q@mail.gmail.com>

```
On Wed, Aug 14, 2013 at 07:42:11AM +0200, Daniel Knittl-Frank wrote:

> > So would that be a bug? Or maybe a feature? I would like it that
> > when you do a rebase and select no commits, it will rebase ontop of
> > the commit you chose, and remove all the commits not shown in the
> > interactive listing (so all).
> 
> You can just use `git reset --hard <commit to rollback to>`  to
> discard all commits after the given commit (Unless they're part of
> another branch, of course). `git reset --soft` if you want to keep the
> state of your current working directory.

You can also use a "noop" line in the rebase instruction list rather
than a completely blank list to mean "yes, really, do not apply any
commits".

-Peff

```
