Skip to main content

Fork a GitHub repo, clone that repo to a local directory, add the upstream remote, create an optional feature branch and checkout that branch

Usage

usage: fork-github-repo [-h] [-c CONFIG] url [branch]

Fork a GitHub repo, clone that repo to a local directory, add the upstream
remote, create an optional feature branch and checkout that branch

positional arguments:
  url                   GitHub URL of the upstream repo to fork
  branch                Name of the feature branch to create

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Filename of the yaml config file (default :
                        ~/.github/fork_github_repo.yaml)

The config file with a default location of
~/.github/fork_github_repo.yaml contains the following settings:

-  github_token : The `GitHub personal access token with the public_repo scope
   allowed.
   https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
-  repo_dir : The directory path to the directory containing all your cloned
    repos. If this isn't defined, /tmp is used.

The file is YAML formatted and the contents look like this :

github_token: 0123456789abcdef0123456789abcdef01234567
repo_dir: ~/Documents/github.com/example/

Config

The config file with a default location of ~/.github/fork_github_repo.yaml contains the following settings.

  • github_token : The GitHub personal access token with the public_repo scope allowed

  • repo_dir : The directory path to the directory containing all your cloned repos. If this isn’t defined, /tmp is used.

Examples

Fork Spoon-Knife

$ fork-github-repo https://github.com/octocat/Spoon-Knife
Forked https://github.com/octocat/Spoon-Knife to git@github.com:gene1wood/Spoon-Knife.git
Cloned git@github.com:gene1wood/Spoon-Knife.git to /path/to/gene1wood/Spoon-Knife
Remote "upstream" created for https://github.com/octocat/Spoon-Knife
Remote "upstream" fetched

Fork Spoon-Knife and create a feature branch called ‘my-feature’

$ fork-github-repo https://github.com/octocat/Spoon-Knife my-feature
Forked https://github.com/octocat/Spoon-Knife to git@github.com:gene1wood/Spoon-Knife.git
Cloned git@github.com:gene1wood/Spoon-Knife.git to /path/to/gene1wood/Spoon-Knife
Remote "upstream" created for https://github.com/octocat/Spoon-Knife
Remote "upstream" fetched
Branch "my-feature" created
Branch "my-feature" pushed to origin
Tracking branch "origin/my-feature" setup for branch "my-feature"
Branch "my-feature" checked out

Metadata

Release files for fork-github-repo 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fork-github-repo 1.2.0
File Size Uploaded
fork-github-repo-1.2.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fork-github-repo 1.2.0
File Interpreter ABI Platform
fork_github_repo-1.2.0-py2-none-any.whl Python 2 none any Details

Total release size: 9.4 kB

Release files / fork-github-repo-1.2.0.tar.gz

Download URL fork-github-repo-1.2.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8e905730f5d963df2ddce666127d47e74a7f2de9cb8c115b2e908693f2e45c17
BLAKE2b-256 checksum
How to use checksums
2ce2114d9f0d6c4eed2b270c759b056dc85f0ac5a1b25c45d380ba1e9742cf26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15rc1

Release files / fork_github_repo-1.2.0-py2-none-any.whl

Download URL fork_github_repo-1.2.0-py2-none-any.whl
Size 5.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
e0dad9a424fbfb18b831f280acf46cdf0e5313165f920f97bea41c00b668a98f
BLAKE2b-256 checksum
How to use checksums
371514b8b5c3f2fcb015ffe1ceaf20df96e6844e662ddde210fb6bdf172edc67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15rc1

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page