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

importing two different trees into a fresh git repo

From
CMConstantine A. Murenin <mureninc@gmail.com>
Date
Feb 5, 2013, 21:46 UTC
Message-ID
<CAPKkNb6+ojb+uvBW+AkhGrhjR85LrJEbmR0KmvaKYb2Cj5Aa4g@mail.gmail.com>
Hi,

I have two distinct trees that were not managed by any RCS, and I'd like to import them into a single repository into two separate orphan branches, then make sense of what's in there, merge, and unify into 'master'.

(To give some context, it's /etc/nginx config files from nginx/1.0.12 on Debian 6 and nginx/1.2.2 on OpenBSD 5.2.)

I've encountered two problems so far:
0. After initialising the repository, I was unable to `git checkout
--orphan Debian-6.0.4-nginx-1.0.12` -- presumably it doesn't work when
the repo is empty?  This sounds like a bug or an artefact of
implementation.  I presume this can be worked around by committing
into master instead, and then doing `git checkout -b
Debian-6.0.4-nginx-1.0.12`, and then force-fixing the master somehow
later on.
1. After making a mistake on my first commit (my first commit into
OpenBSD-5.2-nginx-1.2.2 orphan branch ended up including a directory
from master by mistake), I am now unable to rebase and "fixup" the
changes -- `git rebase --interactive HEAD~2` doesn't work, which, from
one perspective, makes perfect sense (indeed there's no prior
revision), but, from another, it's not immediately obvious how to
quickly work around it.
Any suggestions?

It would seem like making some kind of a dummy first commit into master would be the best workaround for both of these problems. Is that basically the suggested approach?

Best regards, Constantine.

Next: Junio C Hamano
Message 1 of 4 in “importing two different trees into a fresh git repo”
  1. Constantine A. MureninFeb 5, 2013
  2. Junio C HamanoFeb 5, 2013
  3. Constantine A. MureninFeb 6, 2013
  4. Jeff KingFeb 6, 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.