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

Notes

  • GITCODE_TOKEN can be used instead of GC_TOKEN.
  • GITHUB_TOKEN can be used instead of GH_TOKEN.
  • 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.1.tar.gz (10.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.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_fork_tool-0.0.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":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.1.tar.gz
Algorithm Hash digest
SHA256 7ce9dc45a3d8f38a781c5bfaa040afe13de7360fd6978d8179f274f5d2c7c0de
MD5 4072def90cf498859031b9c48bcc1b88
BLAKE2b-256 307e2f0aba2fcac4655e0a69422caa24805a20529984359fe58ceeeb67eae830

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_fork_tool-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b13ebaa39043d221a8fdca6eb77809a71e7c1a2a919197d30072b497b0bef62
MD5 520f51387d192fda602c32d61d241ae3
BLAKE2b-256 58fecaeeb3cc190a4b4697fce5756585e21b524f5a2e83d1d46bd6a37e380f12

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