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

Re: Switch from svn to git and modify repo completely

From
Matthias Fechner <idefix@fechner.net>
Date
Nov 27, 2011, 10:56 UTC
Message-ID
<4ED21756.70705@fechner.net>
In-Reply-To
<20111121070247.GA16708@elie.hsd1.il.comcast.net>
Am 21.11.2011 08:02, schrieb Jonathan Nieder:
Show 9 quoted lines
> The section "CHECKLIST FOR SHRINKING A REPOSITORY" from the
> git-filter-branch(1) manual page has some hints.  In particular, "git
> clone --no-hardlinks" still _copies_ all objects --- you probably
> would want "git clone file://$(pwd)/repo-orig" to make sure the
> ordinary transfer negotiation kicks in.
> 
> It's very important that the documentation not be misleading, so if
> you can point to places where the wording can be less confusing, that
> would be very welcome.

it would be fantastic if exactly this information is noted in the manual. For me it is not really clear what is the difference between a git clone with and without --no-hardlinks.

I was now able to convert my svn repo to a git repo and split the new git repo in several different ones, including the complete history.

Here a short summary for all how need to do the same. At first convert the svn into a git reposity: git svn clone file:///path/to/svn -A authors -s gitrepo.git

To create the authors file, check the man page.

To get a list of all files: git show --pretty="format:" --name-only startrev..endrev | sort | uniq

Maybe you want to remove some branches from the repo because svn users used it in a completely wrong way: git branch -rd badbranch

Now clone the repo and remove files from it you do not want anymore: git clone gitrepo.git tofilter.git cd tofilter.git git filter-branch -f --tree-filter 'rm -Rf file1 file2.bla dir1 \ projekt1/dir2' --prune-empty -- --all git gc cd ..

Repeat this step for all combination you need.

Now create a bare repository and enable some options to use it as a central repo: git clone --bare tofilter.git tofilter_bare.git cd tofilter_bare.git git config core.sharedRepository 1 git config receive.denyNonFastForwards true git gc cd ..

Now you can copy the repo to the target server/directory and clone it from there.

Bye Matthias

-- 
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
Previous: Jonathan NiederNext: Matthias Fechner
Message 5 of 6 in “Switch from svn to git and modify repo completely”
  1. Matthias FechnerNov 19, 2011
  2. Alexey ShumkinNov 19, 2011
  3. Matthias FechnerNov 20, 2011
  4. Jonathan NiederNov 21, 2011
  5. Matthias FechnerNov 27, 2011
  6. Matthias FechnerNov 28, 2011

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.