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

git rebase -i onto HEAD~n

From
BABisani, Alok <alok.bisani@credit-suisse.com>
Date
Feb 3, 2009, 15:17 UTC
Message-ID
<C5E2CAEE4A87D24DAB5334F62A72D1F43ADC9D@ELON17P32001A.csfb.cs-group.com>
Hi,

Is it possible to use git rebase -i for the following use case, in a local branch?

$ git reset --soft HEAD~3 $ # magically squash HEAD~2 & HEAD, ignoring HEAD~1 (which should be discarded) $ git commit -m "new commit replacing current HEAD~2 HEAD, without the commit HEAD~1 (to be discarded)"

I get the error below.
    grep: /home/user/project/.git/rebase-merge/done: No such file or
directory
    Cannot 'squash' without a previous commit
Or could you please suggest another command which is meant to this.

I must mention, that HEAD~3, in my case is the first commit, but I don't think that makes any difference.

$ git --version git version 1.6.0

Best regards, Alok

============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer:

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ==============================================================================

Next: Björn Steinbrink
Message 1 of 6 in “git rebase -i onto HEAD~n”
  1. Bisani, AlokFeb 3, 2009
  2. Björn SteinbrinkFeb 3, 2009
  3. Bisani, AlokFeb 3, 2009
  4. Björn SteinbrinkFeb 3, 2009
  5. Bisani, AlokFeb 3, 2009
  6. Sitaram ChamartyFeb 3, 2009

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.