{"thread":{"id":"29270","subject":"What's the best way to push/fetch replace refs?","startedAt":"2011-12-30T11:59:26Z","lastAt":"2012-01-02T06:16:16Z","messageCount":3,"participants":["Slawomir Testowy","Christian Couder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"181801","messageId":"CAA61mJgCjt0O5LE5OQ=aNbtUHCZeZdZ=3dXYTNv_AhFi7JXwkA@mail.gmail.com","threadId":"29270","inReplyTo":null,"subject":"What's the best way to push/fetch replace refs?","fromName":"Slawomir Testowy","fromEmail":"slawomir.testowy@gmail.com","sentAt":"2011-12-30T11:59:26Z","receivedAt":"2011-12-30T11:59:26Z","isPatch":false,"sender":{"key":"slawomir.testowy@gmail.com","avatar":null},"body":"I want to use git-replace to connect two disjoined commits (git-svn didn't\ndetect massive file movement) and I want to share these replace refs with others\n(we're moving from svn to git). I cannot use git-rebase because the history\nafter the split contains lots of branches and merges and using git-rebase for\nthat is an overkill.\n\nI did something like this:\n\n# Setup some repositories and create basic commit.\ngit init --bare repo\ngit init a\ngit init b\ncd a\necho a > a && git add a && git commit -m initial\ngit branch tmp\necho b > b && git add b && git commit -m second\ngit checkout tmp\necho c > c && git add c && git commit -m replacement\n\n# Replace a commit with another one\ngit replace `git rev-parse master` `git rev-parse tmp`\n\n# Push changes to public repo; this doesn't push replace refs.\ngit push --all ../repo/\n\n# Is this the best way to push replace refs?\ngit push  ../repo/ 'refs/replace/*'\n\n# Fetch commits from public repo\ncd ../b/\ngit pull ../repo/\n\n# We didn't fetch replace refs in previous git-pull. But this seems to\nwork. Is this the correct way?\ngit fetch ../repo/ 'refs/replace/*:refs/replace/*'\n\n# I also added \"fetch = +refs/replace/*:refs/replace/*\" to [remote\n\"origin\"] in \"b\" and this also seems to work.\n"},{"id":"181805","messageId":"CAP8UFD3KSjdZz1q+QYsH4JpRkiavtTbT1WqQSdxqCaxc24j=Rg@mail.gmail.com","threadId":"29270","inReplyTo":"CAA61mJgCjt0O5LE5OQ=aNbtUHCZeZdZ=3dXYTNv_AhFi7JXwkA@mail.gmail.com","subject":"Re: What's the best way to push/fetch replace refs?","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2011-12-30T14:51:43Z","receivedAt":"2011-12-30T14:51:43Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Fri, Dec 30, 2011 at 12:59 PM, Slawomir Testowy\n<slawomir.testowy@gmail.com> wrote:\n>\n> # I also added \"fetch = +refs/replace/*:refs/replace/*\" to [remote\n> \"origin\"] in \"b\" and this also seems to work.\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\nYeah, the simplest is probably to just add \"fetch =\n+refs/replace/*:refs/replace/*\" to the remote(s) you want to get the\nreplace refs from, and \"push = +refs/replace/*:refs/replace/*\" to the\nremote(s) you want to push the replace refs to.\n\nRegards,\nChristian.\n"},{"id":"181835","messageId":"CAA61mJjCKJYAifD3DihAg+pH4Q0Z9y26n3P5KBBy09n-wK9LXg@mail.gmail.com","threadId":"29270","inReplyTo":"CAP8UFD3KSjdZz1q+QYsH4JpRkiavtTbT1WqQSdxqCaxc24j=Rg@mail.gmail.com","subject":"Re: What's the best way to push/fetch replace refs?","fromName":"Slawomir Testowy","fromEmail":"slawomir.testowy@gmail.com","sentAt":"2012-01-02T06:16:16Z","receivedAt":"2012-01-02T06:16:16Z","isPatch":false,"sender":{"key":"slawomir.testowy@gmail.com","avatar":null},"body":"2011/12/30 Christian Couder <christian.couder@gmail.com>:\n> On Fri, Dec 30, 2011 at 12:59 PM, Slawomir Testowy\n> <slawomir.testowy@gmail.com> wrote:\n>>\n>> # I also added \"fetch = +refs/replace/*:refs/replace/*\" to [remote\n>> \"origin\"] in \"b\" and this also seems to work.\n>\n> Yeah, the simplest is probably to just add \"fetch =\n> +refs/replace/*:refs/replace/*\" to the remote(s) you want to get the\n> replace refs from, and \"push = +refs/replace/*:refs/replace/*\" to the\n> remote(s) you want to push the replace refs to.\n>\n> Regards,\n> Christian.\n\nThanks Christian, I thought maybe there is some magic \"git clone\n--get-also-replace-refs\" or something. I'm asking because I'm about to\ntell people how to clone my repository and some of them don't know Git\nat all so I wanted to find out the simplest/best way to fetch replace refs.\n\nThanks.\n"}]}