in lib/pull-request/pr.ts [323:337]
private createHead(): string[] {
return [
// check if head branch exists
`git rev-parse --verify origin/${this.props.head.name} ` +
// checkout and merge if it does (this might fail due to merge conflicts)
`&& { git checkout ${this.props.head.name} && git merge ${this.headSource} && ${this.runCommands()}; } ` +
// create if it doesnt. we initially use 'temp' to allow using exports in the head branch name. (e.g bump/$VERSION)
`|| { git checkout ${this.headSource} && git checkout -b temp && ${this.runCommands()} && git branch -M ${this.props.head.name}; }`,
];
}