git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git rebase -i does not rebase if all lines are removed

From
Carlos Martín Nieto <cmn@elego.de>
Date
Jul 17, 2012, 10:55 UTC
Message-ID
<1342522535.20671.7.camel@centaur.cmartin.tk>
In-Reply-To
<CAGHpTBKn+avCrWegktoJRurG+oycq6Sb9CiRDCBQG=hSMUkjiA@mail.gmail.com>
On Tue, 2012-07-17 at 13:46 +0300, Orgad and Raizel Shaneh wrote:
Show 11 quoted lines
> Make a commit on top of master.
> 
> git rebase -i origin/master
> 
> Remove the commit.
> 
> Git prints "Nothing to do" and does not rebase.
> 
> Running 'git rebase -i' when there are no local commits has 'noop' in
> the first line, and with it the rebase is successful. Why is this
> 'noop' mandatory?
If you read the instructions, the last line says
    # However, if you remove everything, the rebase will be aborted

so if you want to do a no-op, then you need to tell it. This is the same way you abort a commit, by providing it with an empty message.

But more important would be /why/ you feel that rebase -i is the tool you should be using. If you'd like to move the branch pointer back, that's what the reset command is for. rebase deals with moving commits from one base to another and optionally reordering, squashing or removing some of them.

   cmn
Previous: Orgad and Raizel ShanehNext: Johannes Sixt
Message 2 of 3 in “git rebase -i does not rebase if all lines are removed”
  1. Orgad and Raizel ShanehJul 17, 2012
  2. Carlos Martín NietoJul 17, 2012
  3. Johannes SixtJul 17, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.