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

Re: merge maintaining history

From
Jacob Keller <jacob.keller@gmail.com>
Date
Jan 15, 2017, 06:24 UTC
Message-ID
<CA+P7+xoF8E55-XDnQT-GN1=hEwwq4pOsz7--P-SCy29C7ST3Hg@mail.gmail.com>
In-Reply-To
<58798686.5050401@comcast.net>
On Fri, Jan 13, 2017 at 6:01 PM, David J. Bakeman <nakuru@comcast.net> wrote:
Show 19 quoted lines
> History
>
> git cloned a remote repository and made many changes pushing them all to
> said repository over many months.
>
> The powers that be then required me to move project to new repository
> server did so by pushing local version to new remote saving all history!
>
> Now have to merge back to original repository(which has undergone many
> changes since I split off) but how do I do that without loosing the
> history of all the commits since the original move?  Note I need to push
> changes to files that are already in existence.  I found on the web a
> bunch of ways to insert a whole new directory structure into an existing
> repository but as I said I need to do it on top of existing files.  Of
> course I can copy all the files from my local working repository to the
> cloned remote repository and commit any changes but I loose all the
> history that way.
>
> Thanks.
If I understand it.. you have two remotes now:
The "origin" remote, which was the original remote you started with.
You have now a "new" remote which you created and pushed to.

So you want to merge the "new" history into the original tree now, so you checkout the original tree, then "git merge <new-remote>/<branch>" and then fix up any conflicts, and then git commit to create a merge commit that has the new history. Then you could push that to both trees.

I would want a bit more information about your setup before providing actual commands.

Thanks, Jake

Previous: David J. BakemanNext: David J. Bakeman
Message 2 of 9 in “merge maintaining history”
  1. David J. BakemanJan 14, 2017
  2. Jacob KellerJan 15, 2017
  3. David J. BakemanJan 19, 2017
  4. Junio C HamanoJan 19, 2017
  5. Jakub NarębskiJan 20, 2017
  6. Junio C HamanoJan 20, 2017
  7. David J. BakemanJan 26, 2017
  8. Jacob KellerJan 26, 2017
  9. Philip OakleyJan 19, 2017

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.