{"thread":{"id":"28982","subject":"Switch from svn to git and modify repo completely","startedAt":"2011-11-19T17:11:06Z","lastAt":"2011-11-28T10:10:13Z","messageCount":6,"participants":["Matthias Fechner","Alexey Shumkin","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"179735","messageId":"4EC7E32A.9040903@fechner.net","threadId":"28982","inReplyTo":null,"subject":"Switch from svn to git and modify repo completely","fromName":"Matthias Fechner","fromEmail":"idefix@fechner.net","sentAt":"2011-11-19T17:11:06Z","receivedAt":"2011-11-19T17:11:06Z","isPatch":false,"sender":{"key":"idefix@fechner.net","avatar":"https://gravatar.com/avatar/3bbc5542677a77cb9b75262e4ad2eeb04a0960f0b8dec89a178db17cf472cce7?d=mp&s=160"},"body":"Dear Git List,\n\nI just started to migrate a svn repo to a git repo and was successfully\nwith the \"git svn\" command and waiting a long time :)\n\nI have now some confidential documents in the repository I must remove\ncompletely (including the complete history). These are single files\nspread over the complete repository. Is this possible with git?\n\nThe next step I would like to do is separate the repo and smaller ones.\nThe problem here is it is not only take this directory and move it out,\nit is a complete mess and the files are spread over the complete repo\nand over all the revisions (files were moved around in the old\nsubversion repo from folder to folder). Is there a possibility to say\ntake file1, file2, fileN and directory1, directoryN and move it to\nanother repo or remove all not matching files/directories completely?\n\nThanks a lot for some hints which commands I could use here or if it is\npossible.\n\nBye\nMatthias\n"},{"id":"179736","messageId":"20111119225048.384189bc@zappedws","threadId":"28982","inReplyTo":"4EC7E32A.9040903@fechner.net","subject":"Re: Switch from svn to git and modify repo completely","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2011-11-19T18:50:48Z","receivedAt":"2011-11-19T18:50:48Z","isPatch":false,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"> Dear Git List,\n> \n> I just started to migrate a svn repo to a git repo and was\n> successfully with the \"git svn\" command and waiting a long time :)\n> \n> I have now some confidential documents in the repository I must remove\n> completely (including the complete history). These are single files\n> spread over the complete repository. Is this possible with git?\n\ntake a look at \"git filter-branch\"\n"},{"id":"179767","messageId":"4EC97D52.1010308@fechner.net","threadId":"28982","inReplyTo":"20111119225048.384189bc@zappedws","subject":"Re: Switch from svn to git and modify repo completely","fromName":"Matthias Fechner","fromEmail":"idefix@fechner.net","sentAt":"2011-11-20T22:21:06Z","receivedAt":"2011-11-20T22:21:06Z","isPatch":false,"sender":{"key":"idefix@fechner.net","avatar":"https://gravatar.com/avatar/3bbc5542677a77cb9b75262e4ad2eeb04a0960f0b8dec89a178db17cf472cce7?d=mp&s=160"},"body":"Am 19.11.2011 19:50, schrieb Alexey Shumkin:\n> take a look at \"git filter-branch\"\n\nthanks a lot for your answer. I checked the manual page, but it does not\nwork like I expected it or it is described. What I did:\n\n1. I searched the path name with the command:\ngit show --pretty=\"format:\" --name-only firstrev..endrev | sort | uniq\n|grep sdcc\n\n2. I tried to remove the file with the command:\ngit filter-branch -f --tree-filter 'rm -f\nsoftware/tools/net.sourceforge.eclipsesdcc-1.0.0-win32.x86.zip'\n--prune-empty -- --all\n\ngit told me:\nRef 'refs/heads/master' was rewritten\nRef 'refs/remotes/origin/master' was rewritten\nWARNING: Ref 'refs/remotes/origin/master' is unchanged\n\n3. I cloned the repository with:\ngit clone --no-hardlinks repo-orig.git repo-filtered.git\n\n4. After this I verified in the repo-filtered.git that the file was\nreally completely removed, but it was not the case. I was able to\ncheckout the revision which holds the file.\n\nRegarding the manual page it should work... but reality is different.\nHas here anyone an idea what I did wrong?\n\nBye\nMatthias\n\n-- \n\n\"Programming today is a race between software engineers striving to\nbuild bigger and better idiot-proof programs, and the universe trying to\nproduce bigger and better idiots. So far, the universe is winning.\" --\nRich Cook\n"},{"id":"179772","messageId":"20111121070247.GA16708@elie.hsd1.il.comcast.net","threadId":"28982","inReplyTo":"4EC97D52.1010308@fechner.net","subject":"Re: Switch from svn to git and modify repo completely","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-11-21T07:02:47Z","receivedAt":"2011-11-21T07:02:47Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(re-populating cc list)\nHi Matthias,\n\nMatthias Fechner wrote:\n\n> git told me:\n> Ref 'refs/heads/master' was rewritten\n> Ref 'refs/remotes/origin/master' was rewritten\n> WARNING: Ref 'refs/remotes/origin/master' is unchanged\n>\n> 3. I cloned the repository with:\n> git clone --no-hardlinks repo-orig.git repo-filtered.git\n>\n> 4. After this I verified in the repo-filtered.git that the file was\n> really completely removed, but it was not the case.\n\nThe section \"CHECKLIST FOR SHRINKING A REPOSITORY\" from the\ngit-filter-branch(1) manual page has some hints.  In particular, \"git\nclone --no-hardlinks\" still _copies_ all objects --- you probably\nwould want \"git clone file://$(pwd)/repo-orig\" to make sure the\nordinary transfer negotiation kicks in.\n\nIt's very important that the documentation not be misleading, so if\nyou can point to places where the wording can be less confusing, that\nwould be very welcome.\n\nThanks and hope that helps,\nJonathan\n"},{"id":"180016","messageId":"4ED21756.70705@fechner.net","threadId":"28982","inReplyTo":"20111121070247.GA16708@elie.hsd1.il.comcast.net","subject":"Re: Switch from svn to git and modify repo completely","fromName":"Matthias Fechner","fromEmail":"idefix@fechner.net","sentAt":"2011-11-27T10:56:22Z","receivedAt":"2011-11-27T10:56:22Z","isPatch":false,"sender":{"key":"idefix@fechner.net","avatar":"https://gravatar.com/avatar/3bbc5542677a77cb9b75262e4ad2eeb04a0960f0b8dec89a178db17cf472cce7?d=mp&s=160"},"body":"Am 21.11.2011 08:02, schrieb Jonathan Nieder:\n> The section \"CHECKLIST FOR SHRINKING A REPOSITORY\" from the\n> git-filter-branch(1) manual page has some hints.  In particular, \"git\n> clone --no-hardlinks\" still _copies_ all objects --- you probably\n> would want \"git clone file://$(pwd)/repo-orig\" to make sure the\n> ordinary transfer negotiation kicks in.\n> \n> It's very important that the documentation not be misleading, so if\n> you can point to places where the wording can be less confusing, that\n> would be very welcome.\n\nit would be fantastic if exactly this information is noted in the\nmanual. For me it is not really clear what is the difference between a\ngit clone with and without --no-hardlinks.\n\nI was now able to convert my svn repo to a git repo and split the new\ngit repo in several different ones, including the complete history.\n\nHere a short summary for all how need to do the same.\nAt first convert the svn into a git reposity:\ngit svn clone file:///path/to/svn -A authors -s gitrepo.git\n\nTo create the authors file, check the man page.\n\nTo get a list of all files:\ngit show --pretty=\"format:\" --name-only startrev..endrev | sort | uniq\n\nMaybe you want to remove some branches from the repo because svn users\nused it in a completely wrong way:\ngit branch -rd badbranch\n\nNow clone the repo and remove files from it you do not want anymore:\ngit clone gitrepo.git tofilter.git\ncd tofilter.git\ngit filter-branch -f --tree-filter 'rm -Rf file1 file2.bla dir1 \\\nprojekt1/dir2' --prune-empty -- --all\ngit gc\ncd ..\n\nRepeat this step for all combination you need.\n\nNow create a bare repository and enable some options to use it as a\ncentral repo:\ngit clone --bare tofilter.git tofilter_bare.git\ncd tofilter_bare.git\ngit config core.sharedRepository 1\ngit config receive.denyNonFastForwards true\ngit gc\ncd ..\n\nNow you can copy the repo to the target server/directory and clone it\nfrom there.\n\nBye\nMatthias\n\n-- \n\n\"Programming today is a race between software engineers striving to\nbuild bigger and better idiot-proof programs, and the universe trying to\nproduce bigger and better idiots. So far, the universe is winning.\" --\nRich Cook\n"},{"id":"180039","messageId":"4ED35E05.7080605@fechner.net","threadId":"28982","inReplyTo":"4ED21756.70705@fechner.net","subject":"Re: Switch from svn to git and modify repo completely","fromName":"Matthias Fechner","fromEmail":"idefix@fechner.net","sentAt":"2011-11-28T10:10:13Z","receivedAt":"2011-11-28T10:10:13Z","isPatch":false,"sender":{"key":"idefix@fechner.net","avatar":"https://gravatar.com/avatar/3bbc5542677a77cb9b75262e4ad2eeb04a0960f0b8dec89a178db17cf472cce7?d=mp&s=160"},"body":"Am 27.11.11 11:56, schrieb Matthias Fechner:\n> git clone gitrepo.git tofilter.git\n\none additional note.\nTo get it really working you should execute:\ngit clone file://gitrepo.git tofilter.git\n\nAnd later if you copy it to a bare repo:\ngit clone --bare file://tofiler.git barerepo.git\n\nThis will ensure that removed files are not in the cloned repository.\n\nBye,\nMatthias\n\n-- \n\"Programming today is a race between software engineers striving to \nbuild bigger and better idiot-proof programs, and the universe trying to \nproduce bigger and better idiots. So far, the universe is winning.\" -- \nRich Cook\n"}]}