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

Re: How to split a big commit

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Apr 4, 2011, 14:25 UTC
Message-ID
<BANLkTinpiR2sHS35uqD+uLnTKVtimhT7eg@mail.gmail.com>
In-Reply-To
<20110404130016.GA16975@kytes>
On Mon, Apr 4, 2011 at 8:00 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
> To split a big commit, I simply reverse-diff-apply the changes that I
> don't want in the big commit, and I stage all changes.  Then, I again
> reverse-diff-apply all the staged changes, and keep that in the
> unstaged portion.
Won't work for me. The reverse part would be way larger than the to-commit part.
> ...
> I can afford to do this kind of jugglery very easily because I use
> Magit with Emacs.  After highlighting the relevant portions,
> reverse-diff-apply is one keystroke :)

Hmm.. interesting. Never got around to actually use magit. I may have a good reason now.

> But yes, you're probably right-
> there should be an easier way to do this.  Maybe a 'git split' that
> allows you to interactively select the portions of an existing commit
> that you'd like to exclude from the commit and turn into a new commit?

Hmm..yeah something like grep for chunks, then automatically splitting those chunks out would be nice.

I have another use for such a tool too. When .po files are automatically updated by intltool (gnome translation helper tool), comment lines are all changed because they contain source line and those line likely change. With this tool I can filter out comment-only changes.

Thanks for the idea.
-- 
Duy
Previous: Ramkumar RamachandraNext: Jonathan Nieder
Message 3 of 6 in “How to split a big commit”
  1. Nguyen Thai Ngoc DuyApr 4, 2011
  2. Ramkumar RamachandraApr 4, 2011
  3. Nguyen Thai Ngoc DuyApr 4, 2011
  4. Jonathan NiederApr 5, 2011
  5. Lasse MakholmApr 5, 2011
  6. Nguyen Thai Ngoc DuyApr 5, 2011

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.