1GIT-FORK(1) Git Extras GIT-FORK(1)
2
3
4
6 git-fork - Fork a repo on github
7
9 git-fork [<github-repo-url>]
10
12 If a github repo url is given, fork the repo. Like clone but forks
13 first.
14
15 1. forks the repo on github
16
17 2. clones the repo into the current dir
18
19 3. adds the original repo as a remote called upstream
20
21
22
23 If a url is not given and the current dir is a github repo, fork the
24 repo.
25
26 1. forks the current repo
27
28 2. rename the origin remote repo to upstream
29
30 3. adds the forked repo as a remote called origin
31
32
33
34 Remotes will use ssh if you have it configured with GitHub, if not,
35 https will be used. Create a fork a project on GitHub via command
36 line.
37
38 A personal access token is required for making the API call to create a
39 new fork in GitHub. API Documentation here
40 https://docs.github.com/en/rest/reference/repos#forks
41
42 Make sure the personal access token has the right OAuth scopes for the
43 repo(s)
44
45 Use git config --global --add git-extras.github-personal-access-token
46 <your-personal-access-token>
47
48 If using multiple accounts, override the global value in the specific
49 repo using git config git-extras.github-personal-access-token
50 <other-acc-personal-access-token>
51
53 Fork expect.js:
54
55
56
57 $ git fork https://github.com/LearnBoost/expect.js
58
59
60
61 or just:
62
63
64
65 $ git fork LearnBoost/expect.js
66
67
68
69 Then:
70
71
72
73 $ ..<forks into your github profile and clones repo locally to expect.js dir>...
74
75 $ cd expect.js && git remote -v
76
77 origin git@github.com:<user>/expect.js (fetch)
78 origin git@github.com:<user>/expect.js (push)
79 upstream git@github.com:LearnBoost/expect.js (fetch)
80 upstream git@github.com:LearnBoost/expect.js (push)
81
82
83
84 If the current dir is a clone of expect.js, this has the same effect:
85
86
87
88 $ git fork
89
90
91
93 Written by Andrew Griffiths <mail@andrewgriffithsonline.com>
94
96 <https://github.com/tj/git-extras/issues>
97
99 <https://github.com/tj/git-extras>
100
101
102
103 October 2017 GIT-FORK(1)