diff --git a/bin/git-fork b/bin/git-fork index 1294254..0981488 100755 --- a/bin/git-fork +++ b/bin/git-fork @@ -37,6 +37,7 @@ curl -X POST -u "$user" "https://api.github.com/repos/$owner/$project/forks" if [ "$origin" = true ]; then git remote rename origin upstream git remote add origin "https://github.com/$user/$project" + git fetch origin else # clone forked repo into current dir git clone "https://github.com/$user/$project" "$project" diff --git a/man/git-fork.1 b/man/git-fork.1 index c27cddb..e9e8043 100644 --- a/man/git-fork.1 +++ b/man/git-fork.1 @@ -19,7 +19,7 @@ forks the repo on github clones the repo into the current dir . .IP "3." 4 -adds the original repo as a remote called upstream +adds the original repo as a remote called \fBupstream\fR . .IP "" 0 . @@ -30,10 +30,10 @@ If a url is not given and the current dir is a github repo, fork the repo\. forks the current repo . .IP "2." 4 -rename the \'origin\' remote repo to \'upstream\' +rename the \fBorigin\fR remote repo to \fBupstream\fR . .IP "3." 4 -adds the forked repo as a remote called origin +adds the forked repo as a remote called \fBorigin\fR . .IP "" 0 . diff --git a/man/git-fork.html b/man/git-fork.html index e69de29..268c6c0 100644 --- a/man/git-fork.html +++ b/man/git-fork.html @@ -0,0 +1,150 @@ + + + + + + git-fork(1) - Fork a repo on github + + + + +
+ + + +
    +
  1. git-fork(1)
  2. +
  3. Git Extras
  4. +
  5. git-fork(1)
  6. +
+ +

NAME

+

+ git-fork - Fork a repo on github +

+ +

SYNOPSIS

+ +

git-fork [<github-repo-url>]

+ +

DESCRIPTION

+ +

If a github repo url is given, fork the repo. Like clone but forks first.

+ +
    +
  1. forks the repo on github
  2. +
  3. clones the repo into the current dir
  4. +
  5. adds the original repo as a remote called upstream
  6. +
+ + +

If a url is not given and the current dir is a github repo, fork the repo.

+ +
    +
  1. forks the current repo
  2. +
  3. rename the origin remote repo to upstream
  4. +
  5. adds the forked repo as a remote called origin
  6. +
+ + +

EXAMPLE

+ +

Fork expect.js:

+ +
$ git fork https://github.com/LearnBoost/expect.js
+
+ +

or just:

+ +
$ git fork LearnBoost/expect.js
+
+ +

Then:

+ +
$ ..<forks into your github profile and clones repo locally to expect.js dir>...
+
+$ cd expect.js && git remote -v
+
+  origin          https://github.com/<user>/expect.js (fetch)
+  origin          https://github.com/<user>/expect.js (push)
+  upstream        https://github.com/LearnBoost/expect.js (fetch)
+  upstream        https://github.com/LearnBoost/expect.js (push)
+
+ +

If the current dir is a clone of expect.js, this has the same effect:

+ +
$ git fork
+
+ +

AUTHOR

+ +

Written by Andrew Griffiths <mail@andrewgriffithsonline.com>

+ +

REPORTING BUGS

+ +

<https://github.com/tj/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/tj/git-extras>

+ + +
    +
  1. +
  2. July 2016
  3. +
  4. git-fork(1)
  5. +
+ +
+ + diff --git a/man/git-fork.md b/man/git-fork.md index 523a1d5..e651b2b 100644 --- a/man/git-fork.md +++ b/man/git-fork.md @@ -11,13 +11,13 @@ git-fork(1) -- Fork a repo on github 1. forks the repo on github 2. clones the repo into the current dir - 3. adds the original repo as a remote called upstream + 3. adds the original repo as a remote called `upstream` If a url is not given and the current dir is a github repo, fork the repo. 1. forks the current repo - 3. rename the 'origin' remote repo to 'upstream' - 3. adds the forked repo as a remote called origin + 3. rename the `origin` remote repo to `upstream` + 3. adds the forked repo as a remote called `origin` ## EXAMPLE