git-fork is used to create a personal fork of a repository hosted on a forge such as GitLab or GitHub. Creating a personal fork is an idempotent operation, meaning that you can run
git-fork as many times as you like, you will still only end up with a single personal fork of a repository. git-fork can also optionally clone the personal fork (after it has been created) to a local repository on your machine. Finally,
git-fork can also do some lightweight setup of the local repository after is has been cloned, such as setting up a remote pointing to the upstream repository, sync the personal fork with the upstream repository and configuring pre-push hooks.
git-fork requires that a personal access token is set up.
Create a personal fork of openjdk/jdk and also clone it to a local repository:
Create a personal fork openjdk/jdk and use SSH when cloning the personal fork to a local repository (will use
email@example.com:<username>/jdk when cloning the personal fork):
Create a personal fork openjdk/jdk and when cloning the personal fork only clone the 10 most recent commits (truncate the rest of the history):
Like for all Skara CLI tools you can configure default values for the flags for
git-fork. This can come in handy if you find yourself using git-fork frequently and want a bit less to type at the command-line. You can for example configure the host that
git-fork will use for openjdk/jdk:
Using the above you know only have to type
git fork openjdk/jdk when creating a personal fork of the openjdk/jdk repository.
If you prefer to work with multiple local clones of your personal fork (perhaps one clone per patch you are working on?) then you can shorten your clone times by specifying a local repository that always should be referenced when running git fork openjdk/jdk:
If you want git-fork to always sync your personal fork after having cloned your personal fork, set
fork.sync to "true":