Forking - adamallaf/lime GitHub Wiki

Forking a Go project like Lime is a bit different than other kinds of projects. Due to the nature of Go packaging, it is important to maintain the same name for the repo in your local $GOPATH when making changes and fixes which you intend to send back with pull requests. This is because the Lime code (and most large Go projects in general) references the full path to its other packages through-out the code like so:

import (
    . "github.com/limetext/lime/backend"
)

So let's walk through the process.

  • You should first follow the directions in the Building document.
  • You will now have a $GOPATH/src/github.com/limetext/lime directory, which is actually a Git repo.
  • Fork Lime on GitHub, and copy the URL shown for your fork into your clipboard.
  • Go into $GOPATH/src/github.com/limetext/lime and type the following command:
git remote add fork <your GitHub fork URL, pasted from the clipboard>
  • Make your code changes, compile and test them, then:
git push fork
  • Then you can open a pull request to Lime to get your code merged into the main repository.
  • To keep your fork in sync with the original lime repo, you essentially need to do:
git pull --rebase origin
git push fork

For more information about this, read the GitHub documentation about forks. Just keep in mind that for Go projects things work in reverse: instead of cloning your fork and adding the upstream as a remote, you clone the upstream and add your fork as a remote. In fact, go get will do the clone of the upstream for you.