I wrote a function just like this in one of my other pulls (that hasn't been merged). Would you want to use [that one](https://github.com/iFixit/git-scripts/pull/78/files#L1R29)?