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

Directory renames without breaking git log.

From
Kai Blin <kai@samba.org>
Date
Sep 3, 2008, 21:38 UTC
Message-ID
<200809032338.35359.kai@samba.org>
Hi folks,

in an effort to make Samba development easier, we're trying to merge the Samba3 and Samba4 branches into a single branch. In order to do so, we need to rename the "source" directories both Samba 3 and Samba 4 have (we're planning to use source3 and source4).

Unfortunately, the directories are big enough that git log stops to track the renamed files, so e.g. git log ./samba3 does not show the samba3 history. The history is not lost, of course, but it's way less intuitive to get it.

Here's how we merged the two branches:
$ mkdir samba-merged
$ cd samba-merged
$ git init
... (create COPYING, README and other top-level files, git add them)
$ git commit -m "Initial commit of merged samba"
$ git remote add git://git.samba.org/samba.git samba
$ git remote update
$ cp -a ~/samba3/source source3
$ cp -a ~/samba4/source source4
$ git add source3 source4
$ git write-tree
$ echo "merge branches" | git commit-tree <sha1 git write-tree retured> \
      -p <sha1 of the initial commit> \
      -p <sha1 of the current samba3 head> \
      -p <sha1 of the current samba4 head>
$ git reset --hard <sha1 returned by git commit-tree>
$ git log
... history is there as expected
$ git log samba3
... history is just the merge commit
$ git log samba4
... history is just the merge commit

Is there any way to fix this that doesn't involve changing the history with git-filter-branch?

Cheers, Kai

-- 
Kai Blin
WorldForge developer  http://www.worldforge.org/
Wine developer        http://wiki.winehq.org/KaiBlin
Samba team member     http://www.samba.org/samba/team/
--
Will code for cotton.
Next: Tarmigan
Message 1 of 8 in “Directory renames without breaking git log.”
  1. Kai BlinSep 3, 2008
  2. TarmiganSep 4, 2008
  3. Kai BlinSep 4, 2008
  4. Junio C HamanoSep 4, 2008
  5. Kai BlinSep 4, 2008
  6. Junio C HamanoSep 4, 2008
  7. Jakub NarebskiSep 4, 2008
  8. TarmiganSep 4, 2008

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.