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

Re: rebase --continue confusion

From
Jeff King <peff@peff.net>
Date
Jun 6, 2010, 22:46 UTC
Message-ID
<20100606224601.GB11424@coredump.intra.peff.net>
In-Reply-To
<19468.8730.59682.76355@winooski.ccs.neu.edu>
On Sun, Jun 06, 2010 at 06:32:58PM -0400, Eli Barzilay wrote:
Show 25 quoted lines
> > >   $ git add foo
> > >   $ git status -s
> > >   M  foo
> > >   $ git commit --amend foo
> > >   # On branch master
> > >   # No changes
> > >   $ git status -s
> > >   M  foo
> > 
> > I'm confused. Is there some context for when you are issuing these
> > commands?  Because the "git commit --amend foo" should actually
> > commit foo, and does for me.
> 
> Heh, in that case it was more effective than I thought...  My point in
> the previous posts was also about missing information (in that case,
> make `git add' tell you when adding it canceled previously added
> changes, and also make `git status' tell you if you're in the middle
> of a merge or rebase and in a clean state).
> 
> In any case, here's the prelude to the above:
> 
>   $ mkdir t; cd t; git init
>   $ echo foo > foo; git add foo; git commit -m foo
>   $ echo bar > foo; git commit -o foo -m bar
>   $ echo foo > foo

Ah, I see. Your problem has nothing to do with explicit pathnames (which I thought was the interesting bit from your snippet), but rather that you are amending it to the same as HEAD^.

Probably it would be helpful in the case of an amend to indicate what has happened (you have no changes, but it is not immediately obvious that you have no changes against HEAD^, not HEAD). We could even suggest "git reset HEAD^", which is probably what you want (the only other thing you could want is to create a commit with no changes, which we generally try to avoid).

-Peff
Previous: Eli BarzilayNext: Eli Barzilay
Message 7 of 12 in “rebase --continue confusion”
  1. Dale RowleyMay 30, 2010
  2. Tim VisherMay 30, 2010
  3. skillzero@gmail.comMay 31, 2010
  4. Eli BarzilayJun 6, 2010
  5. Jeff KingJun 6, 2010
  6. Eli BarzilayJun 6, 2010
  7. Jeff KingJun 6, 2010
  8. Eli BarzilayJun 6, 2010
  9. Jeff KingJun 7, 2010
  10. Junio C HamanoMay 31, 2010
  11. Ramkumar RamachandraMay 31, 2010
  12. Jan KrügerMay 31, 2010

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.