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

sane, stable renames; when a commit should commit twice

From
ZHZenaan Harkness <zen@freedbms.net>
Date
Dec 23, 2007, 02:03 UTC
Message-ID
<20071223020310.GA22450@freedbms.net>
When should a commit, commit twice?
When one or more git mv file renames/ moves are involved.

In such a case the commit ought to be split into two. Perhaps move the files in the first commit, then make the changes needed to support the move in the build chain (including changes in the moved files) in the second commit.

This keeps a clean record of the move, making the move, and the associated changes (as two commits) a clean cherry.

Does this make sense?

I develop in the java world, and we use packages (directories, and subdirectories, sub-sub... etc) a lot, and so it is not uncommon in my 10 years development, to decide to reorganise some package/dir every now and then, and files, and whole dirs, get moved.

I've only been using git for a few weeks, but finding it truly awesome! A little demanding in the initial learning curve - took me three days of reading and a little experiementation here and there, before I finally felt comfortable with rebasing, branching, etc, to effect my work pattern.

Have used arch/tla, a little bzr, aegis for a couple of years long time ago, some cvs, and bk for four months or so.

I'm hoping that the above workflow, which has just crystallized for me in the last two days, makes sense.

zen
-- 
Homepage: www.SoulSound.net -- Free Australia: www.UPMART.org
Please respect the confidentiality of this email as sensibly warranted.
Next: David Symonds
Message 1 of 4 in “sane, stable renames; when a commit should commit twice”
  1. Zenaan HarknessDec 23, 2007
  2. David SymondsDec 23, 2007
  3. Jakub NarebskiDec 23, 2007
  4. Junio C HamanoDec 23, 2007

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.