Another way to contribute to Glamorous Toolkit through a GitHub pull request
In How to contribute to Glamorous Toolkit through a GitHub pull request a specific UI driven procedure is described that makes a number of assumptions and has a number of prerequisites.
While this procedure works fine, some people might prefer a different approach as both creating a fork and a pull request can also be done outside of GT.
This document describes how to make this work.
Prerequisites
You need a GitHub account and set up git to work with unattended authentication.
We continue from the example in How to contribute to Glamorous Toolkit through a GitHub pull request in the sense that we want to contribute the same code to the same package and repository.
repositoryName := 'gtoolkit-inspector'
Fork
Go to the GitHub web interface and make sure you are logged in. Browse to https://github.com/feenkcom/gtoolkit-inspector and click the Fork button. Should you already have a fork, you can bring it up to date by syncing it.
Your personal fork will have a similar URL, like https://github.com/svenvc/gtoolkit-inspector, we need the SSH variant.
forkURL := 'git@github.com:svenvc/gtoolkit-inspector.git'
Start clean
It is highly recommended that you start with a clean image.
Clone your fork
In the case of a ready made distribution GT image from https://gtoolkit.com/download/ you won't have any repositories defined, but there will be a history record.
historyRecord := GtGitRepositoryRegistryHistory instance repositoryNamed: repositoryName
In a developer image where repositories are already defined, we can reference the repository via the registry.
originalRepository := IceRepository repositoryNamed: repositoryName
It is a good idea to keep an eye on the reference commit of the code that is in the image, this is the head commit at the time the code was loaded. Ideally it should correspond with the head commit of the repository that we are going to clone.
From the history record you access the reference commit as follows.
referenceCommit := historyRecord headCommitId
From an existing repository you access the reference commit as follows.
referenceCommit := originalRepository head commit id
Now we can delete the original repository from disk, in the case it is present.
(GtIceRepositorySwitcher new named: repositoryName) deleteDirectory
Finally we can clone our fork and register it. If necessary the original repository will be replaced.
forkedRepository := GtIceRepositorySwitcher new sshUrl: forkURL; useLibgitCLI; cloneAndCreate; register; iceRepository
Checking the reference commit.
self assert: forkedRepository head commit id = referenceCommit
It is good to be aware of this situation, though the pull request will probably still work. If you are behind you would try reloading packages by doing a pull.
Create a feature branch
Before we make our changes, we have to create a feature branch, either in the UI or by executing the following code.
forkedRepository createBranch: 'feature-color-gt-view-circle'; configureUpstreamIfNecessary
Make your changes, commit and push
Just like in How to contribute to Glamorous Toolkit through a GitHub pull request make your code changes, commit and push to your fork.
Create your pull request
Now go to the GitHub web interface and create a new pull request from your new feature branch in your personal fork to the repository you forked from.