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