Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions github.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
// -------

Expand Down Expand Up @@ -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
Expand Down