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

Re: Need help merging unrelated histories

From
RDRobert Dailey <rcdailey.lists@gmail.com>
Date
May 28, 2019, 18:26 UTC
Message-ID
<CAHd499CZnhzw+sKM_Nx4_SvUT5YWaLWr9SmBKCkOcH4=wSdaqA@mail.gmail.com>
In-Reply-To
<CAHd499BQO8E99Y4=T9V6xXDuDyHdqMJ_sQM4DTraAxLzKf+Z-Q@mail.gmail.com>
On Tue, May 28, 2019 at 8:35 AM Robert Dailey <rcdailey.lists@gmail.com> wrote:
Show 16 quoted lines
>
> On Fri, May 24, 2019 at 12:11 PM Andreas Schwab <schwab@linux-m68k.org> wrote:
> >
> > On Mai 24 2019, Robert Dailey <rcdailey.lists@gmail.com> wrote:
> >
> > > Can anyone provide some advice on how to properly restructure this
> > > repository to create some ancestry, as if all along a `master` existed
> > > and all release branches were based on this in a linear fashion?
> >
> > How about using git replace --graft, then git filter-branch to make it
> > permanent?
>
> I unfortunately have little-to-no experience with low level plumbing
> commands. Could you provide an example of a series of commands to run?
> It will help me to figure out how to do it on my own for my specific
> use case. Thanks in advance.

Toyed around with it a bit, and tried with the script below. There were no errors, but I noticed that it erased my `.gitattributes` file on master that I committed before performing the graft. Why did it remove the file? I assume I'm not doing this correctly. Please advise. Thank you.

```sh #!/usr/bin/env bash set -ex

if [[ ! -d Native_SDK.git ]]; then
    git clone --bare git@github.com:powervr-graphics/Native_SDK.git
else
    cd Native_SDK.git
    git fetch
    cd -
fi

rm -rf test_repo git clone Native_SDK.git test_repo cd test_repo

git checkout -f --orphan new_master echo '* text=auto' > .gitattributes git add .gitattributes git commit -m 'Add gitattributes file'

c=$(git log --oneline origin/3.4 | tail -1 | cut -d ' ' -f 1) git replace --graft $c new_master git filter-branch HEAD..origin/3.4 git merge --no-edit --no-ff origin/3.4 ```

Previous: Robert DaileyNext: Philip Oakley
Message 6 of 7 in “Need help merging unrelated histories”
  1. Robert DaileyMay 24, 2019
  2. Robert DaileyMay 24, 2019
  3. Ævar Arnfjörð BjarmasonMay 24, 2019
  4. Andreas SchwabMay 24, 2019
  5. Robert DaileyMay 28, 2019
  6. Robert DaileyMay 28, 2019
  7. Philip OakleyMay 29, 2019

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.