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

What is the best way to perform a complex refactoring spanning multiple repositories?

From
KFKristian Freed <kristian.freed@gmail.com>
Date
Jul 26, 2013, 10:56 UTC
Message-ID
<CAFw3YtRyTAehOWpRkpwLWUjOFC6eB7Mk6=r_RGcjREGGHNafKA@mail.gmail.com>
Hi,

I need to re-organize a project using git. This project currently has 3 separate (central) repositories and I will need to move a large number of files back and forth between them. While doing this, there is development going on on each branch, and the restructuring will take some time. I have been continuously rebasing my refactor branches from master in each respective repository.

Is there an established way of doing this sort of complex cross repository refactoring in a way that preserves the history across repositories and takes advantage of git's rename merge logic across repositories, by say moving all repos into a third one, do the merge and move back?

Effectively, I have three repositories, A, B, and C. I want to move files from B to A and C and preserve history. This is not a simple move of one directory, but a large number of individual files being moved to new locations, renamed, updated etc. I have been working across A, B, and C, moving and updating files, but this will obviously not keep the history of the files being moved across repositories. I imagine that it would be possible to create a new repository D, import A, B, and C into sub directories, rebase to merge the individual commits on A, B, and C into one new big commit on D that will make git understand that files have been moved across, not just removed in one place and deleted from another, then apply the changes back to each individual repository?

Thanks, Kristian

Message 1 of 1 in “What is the best way to perform a complex refactoring spanning multiple repositories?”
  1. Kristian FreedJul 26, 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.