diff --git a/lib/Repository.js b/lib/Repository.js index 3908775c..039df9b0 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -563,6 +563,21 @@ class Repository extends Requestable { }, cb); }); } + + /** + * Delete a branch. + * @param {string} branch - the name of the branch would be deleted + * @param {Requestable.callback} cb - will receive the commit data for the head of the new branch + * @return {Promise} - the promise for the http request + */ + deleteBranch(branch, cb) { + return this.getRef(`heads/${branch}`) + .then((response) => { + return this.deleteRef({ + ref: `refs/heads/${branch}`, + }, cb); + }); + } /** * Create a new pull request