diff --git a/README.md b/README.md index 39fea264..e444f54b 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,12 @@ Fork repository. This operation runs asynchronously. You may want to poll for `r repo.fork(function(err) {}); ``` +Fork repository to an organzation. + +```js +repo.fork("your-org-name", function(err){}); +``` + Create new branch for repo. You can omit oldBranchName to default to "master". ```js diff --git a/github.js b/github.js index ab94104d..27fb9365 100644 --- a/github.js +++ b/github.js @@ -252,6 +252,13 @@ _request("DELETE", repoPath + "/git/refs/"+ref, options, cb); }; + // Edit a repo + // ------- + + this.editRepo = function(options, cb) { + _request("PATCH", repoPath, options, cb); + }; + // Create a repo // ------- @@ -446,8 +453,15 @@ // Fork repository // ------- - this.fork = function(cb) { - _request("POST", repoPath + "/forks", null, cb); + this.fork = function(org, cb) { + if(typeof org =="function"){ + cb = org; + org = null; + } + else{ + org = {organization: org}; + } + _request("POST", repoPath + "/forks", org, cb); }; // Branch repository