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

Re: Splitting a commit with rebase -i and keeping a commit message

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Apr 17, 2013, 05:55 UTC
Message-ID
<516E395D.3050307@viscovery.net>
In-Reply-To
<20130416203825.3701d98b@bigbox.christie.dr>
Am 4/17/2013 3:38, schrieb Tim Chase:
Show 20 quoted lines
> I asked this on IRC and played with some of their ideas, but struck
> out with anything satisfying.  I walked through [1] with the
> following setup:
> 
>   git init foo
>   cd foo
>   touch a.txt b.txt
>   git add a.txt b.txt
>   git commit -m "Initial checkin"
>   echo "Modify A" >> a.txt
>   git commit -am "Modified A"
>   echo "Modify B" >> b.txt
>   git commit -am "Modified B"
>   echo "Modify A2" >> a.txt
>   echo "Modify B2" >> b.txt
>   git commit -am "Modified B"
>   git commit -am "Long-bodied commit comment about b.txt changes"
>   # whoops, just wanted B
>   git rebase -i HEAD^^
>   # change the "Added b.txt..." commit to "edit"
    # and duplicate the instruction line
    git checkout HEAD^ b.txt # undo b.txt
    git commit --amend -m "Tweaked a.txt"
    git rebase --continue
    # in real world cases, you are likely to see conflicts here
    # when the commit is applied a second time,
    # but not in this toy example
    git rebase --continue
-- Hannes
Previous: Tim Chase
Message 4 of 4 in “Splitting a commit with rebase -i and keeping a commit message”
  1. Tim ChaseApr 17, 2013
  2. David AguilarApr 17, 2013
  3. Tim ChaseApr 17, 2013
  4. Johannes SixtApr 17, 2013

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.