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

How to replace master branch of a repo with that of another totally unrelated repo?

From
PPCMan <pcman.tw@gmail.com>
Date
Aug 6, 2010, 07:38 UTC
Message-ID
<AANLkTiksJd-VfiP2Wzz-FsZoJk8djWyuxgweQpy6WaPB@mail.gmail.com>

Hello, I want to rewrite a program totally from scratch rather than branching from current one. So I created a new repo for it and do the development there. Now it's finished and I want to replace the old program with it. Is it possible to replace the master branch of the old repo with the code in this new repo? I want to move the old code to a separate branch for backup, and replace the master branch with the master branch of the new repo. Since git rm -r * than git add all new files will lost history of new repo, it's not an option. The old repo is a public online repo used by multiple users. So just renaming the repo won't work since the users who pull code from the old repo will get troubles. What's the best strategy for smooth migration in this case? I'm not able to find the answer on Google.

Thank you all.
Next: Ramkumar Ramachandra
Message 1 of 3 in “How to replace master branch of a repo with that of another totally unrelated repo?”
  1. PCManAug 6, 2010
  2. Ramkumar RamachandraAug 6, 2010
  3. PCManAug 6, 2010

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.