Emily Shaffer <emilyshaf...@google.com> writes: > More generally, I think you should take a look at `git help git` and > check out the difference between "porcelain" and "plumbing" commands. > The former, of which `git branch` is one, are intended for interactive > use and not really meant for scripting or piping. You can usually come > up with an equivalent from the plumbing commands, which Bryan has > suggested for you with `git for-each-ref`. Git project tries very > hard to maintain output format of the plumbing commands so as to not > break folks' scripts, but such promises aren't usually made for > porcelain commands.
Thanks for a detailed response. Git project promises that output format of the Porcelain commands is subject to change, in order to support human eyeballs better. Unless documented otherwise (e.g. "git status --porcelain"), it is unwise to try parsing porcelain output---your script may break any time and you get to keep both halves. That is not the same as saying "do not script using Porcelain". Sending the output directly to the end user (e.g. compute the revision range in your script that finally calls "git log" using that computed revision range) is perfectly fine. Thanks.