From: Maaartin Date: Wed, 12 Jan 2011 22:47:31 GMT Subject: Re: [RFC/PATCH] Documentation: start to explain what git replace is for Message-ID: In-Reply-To: <20110112000812.GA31950@burratino> Jonathan Nieder gmail.com> writes: > +. The following example comes from ??????? ??????: I know unicode exists already for many years, but in cygwin I get just a bunch of question marks instead of the name. So I'd suggest to replace "Алексей Шумкин" by "Alexej Shumkin" or whatever his preferred transcription is. > +<1> Find all parentless commits in the 'master' branch; > +for 'master' read the branch holding v2.5 history. Aren't you later calling it "FIRST" and assuming there's only one? > +$ sed -i "/^tree / a \\ > +parent $(git rev-parse v2.4)" new <4> Isn't the combination of "-i" (=in-place edit) with redirection wrong? I hardly know anything about sed (abandoned it in favor of perl many years ago). > +$ git hash-object -t commit -w new <5> > +$ git replace FIRST <6> I'd prefer something like +$ objectId=$(git hash-object -t commit -w new) +$ git replace FIRST $objectId This is easier for people just willing to use it without much thinking, and also for those having no idea that git-hash-object creates a new object. That said, it's a nice example and I've learned quite a few things.