Skip to main content

A lightweight CLI for Git fork repositories.

Project description

git-fork-tool

A lightweight CLI for working with Git fork repositories.

Currently supports GitCode and GitHub.

Usage

Set an access token:

export GC_TOKEN=your_token
# or
export GH_TOKEN=your_token

Add the parent repository as upstream:

gft repo init

Check fork sync status:

gft repo sync main --status

Trigger a fork sync:

gft repo sync main

Fetch an upstream pull request into a stable local ref and print that ref:

gft pr fetch 123

Create local branches with git:

git switch -c pr-123-original "$(gft pr fetch 123)"
git switch -c pr-123-experiment "$(gft pr fetch 123)"

Update an existing local branch with git:

ref="$(gft pr fetch 123)"
git switch pr-123-original
git merge --ff-only "$ref"

Rebase local experiment commits onto the latest PR:

ref="$(gft pr fetch 123)"
git switch pr-123-experiment
git rebase "$ref"

Reset a local branch to the latest PR:

ref="$(gft pr fetch 123)"
git switch pr-123-original
git reset --hard "$ref"

Print the ref or refspec without fetching:

gft pr ref 123
gft pr refspec 123

gft pr fetch and gft pr refspec detect the platform from the remote URL.

Notes

  • GITCODE_TOKEN can be used instead of GC_TOKEN.
  • GITHUB_TOKEN can be used instead of GH_TOKEN.
  • GitHub PR refs use refs/pull/<number>/head; GitCode MR refs use refs/merge-requests/<number>/head.
  • For GitHub, --status uses the compare API.
  • Triggering GitHub sync requires contents write permission.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_fork_tool-0.0.2.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_fork_tool-0.0.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file git_fork_tool-0.0.2.tar.gz.

File metadata

  • Download URL: git_fork_tool-0.0.2.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for git_fork_tool-0.0.2.tar.gz
Algorithm Hash digest
SHA256 eb58871f4e3f3a8bc1e24fea4d0db2992346423da6a80a220bdd775b53a41384
MD5 843a876785a32c9712c1282a930d628c
BLAKE2b-256 76681de36aca49068dd763ff1cf9301f19924ca34a47512a5bef6404ba623523

See more details on using hashes here.

File details

Details for the file git_fork_tool-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: git_fork_tool-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for git_fork_tool-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8230e5b8e45ad426e6edcf32275f8155c9c6d0d7f71c1b303fbf95ad716eaffb
MD5 feae9106fc5cbbe20061eab608e75282
BLAKE2b-256 c926ff1a7d60994788fba4b544449c9809151a30a094d25f8b6252d7a3161127

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page