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.git
Forked https://github.com/octocat/Spoon-Knife.git to https://github.com/gene1wood/Spoon-Knife.git
Cloned https://github.com/gene1wood/Spoon-Knife.git to /home/gene/code/github.com/gene1wood/Spoon-Knife
Remote "upstream" created for https://github.com/octocat/Spoon-Knife.git
Remote "upstream" fetched

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

$ fork-github-repo https://github.com/octocat/Spoon-Knife.git my-feature
Forked https://github.com/octocat/Spoon-Knife.git to https://github.com/gene1wood/Spoon-Knife.git
Cloned https://github.com/gene1wood/Spoon-Knife.git to /home/gene/code/github.com/gene1wood/Spoon-Knife
Remote "upstream" created for https://github.com/octocat/Spoon-Knife.git
Remote "upstream" fetched
Branch "my-feature" created and checked out

Metadata

Release files for fork-github-repo 1.0.1

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.0.1
File Size Uploaded
fork-github-repo-1.0.1.tar.gz 4.0 kB Details

Built distribution (wheel)

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

Total release size: 10.4 kB

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

Download URL fork-github-repo-1.0.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8487d6e3d3922b80adea175b5dc3f9b48e193f9893dd4754627a109ba6199f54
BLAKE2b-256 checksum
How to use checksums
237c5d90bc54e3dd5079e539c5d8cfe5179f08ce9211a369738df1dba8931745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL fork_github_repo-1.0.1-py2-none-any.whl
Size 6.5 kB
Tags Python 2
SHA-256 checksum
How to use checksums
17bb160b87b17e71010d5530d13e996bcbb106dfaf5a8c8419f2d85f10c3a881
BLAKE2b-256 checksum
How to use checksums
6a7875083a09ab3512a5e369a10f4dd96b0389a687f748e6990972d531cf4bd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.2.0

2 release files

1.1.0

2 release files

This release

1.0.1 This release

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