Re: [RFC/PATCH] Documentation: start to explain what git replace is for
- From
- Maaartin <grajcar1@seznam.cz>
- Date
- Jan 12, 2011, 22:47 UTC
- Message-ID
- <loom.20110112T232501-316@post.gmane.org>
- In-Reply-To
- <20110112000812.GA31950@burratino>
Jonathan Nieder <jrnieder <at> 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)" <tmp >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 <object id from hash-object> <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.