Skip to content

Instantly share code, notes, and snippets.

@timrchavez
Created December 3, 2012 04:28
Show Gist options
  • Save timrchavez/4192700 to your computer and use it in GitHub Desktop.
Save timrchavez/4192700 to your computer and use it in GitHub Desktop.
Throw away the first two components, leaving the rest of the path as the branch "name"
diff --git a/github.js b/github.js
index cd1cf38..01c01db 100644
--- a/github.js
+++ b/github.js
@@ -199,7 +199,7 @@
this.listBranches = function(cb) {
_request("GET", repoPath + "/git/refs/heads", null, function(err, heads) {
if (err) return cb(err);
- cb(null, _.map(heads, function(head) { return _.last(head.ref.split('/')); }));
+ cb(null, _.map(heads, function(head) { return _.rest(head.ref.split('/'), 2).join('/'); }));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment