Contribute to projects on GitHub
If you want to contribute to a project that is hosted on GitHub and that you cannot push to directly, follow this workflow:
Create a fork of the project you want to contribute to.
Clone this fork to create a local repository.
Make changes to your copy of the original project, commit and push them.
When you are ready to share the results of your work, rebase your fork on the current HEAD of the master branch in the original project. This is needed to make sure your changes do not conflict with new commits that were pushed after you created your fork.
Create a pull request to suggest your changes to the original project.
Display and apply suggestions locally.
Fork a project
A fork is your copy of a GitHub repository that allows you to make changes to code without affecting the original project.
Create a fork
Open the project that you want to fork on GitHub and click
A copy of the original project will be created under your account. To make changes to this project, you need to clone it to create a local repository.
Rebase a fork
From the main menu, choose Git | GitHub | Sync Fork. Your fork will be rebased onto the HEAD commit in the master branch of the original project you created your fork from.
Watch this video tutorial on how to keep your fork of a project up to date:
Create a pull request
Pull requests are used in open-source projects or in some corporate workflows to manage changes from contributors and to initiate code review before such changes are merged.
By creating a pull request, you tell others about the changes you've pushed to your fork of a GitHub repository, so that the maintainers of the original repository can review your changes, discuss them, and integrate them into the base branch.
From the main menu, choose Git | GitHub | Create Pull Request. The Create Pull Request dialog opens.
Under Base Fork, specify the project that you want to send the pull request to. Either select a repository from the list populated by GoLand, or click Select Other Fork.
Under Base Branch, specify the branch in the target project that your changes will be applied to. Click Show Diff to review the list of commits that will be included in the pull request. To view the details of a commit, select it and switch to the Log tab of the Version Control tool window Alt+9, where you can see a list of files included in the selected commit, view diff, and so on.
Specify the name for your pull request in the Title field, and, optionally, provide a description of the changes to be applied through your request.
View and apply the suggested changes
If the maintainers of the original repository left comments or made suggestions with regard to your changes, you can view and apply them directly from GoLand.
From the main menu, select
.Open the Files tab. To the right of each file, you'll see a counter with the number of comments or suggestions a reviewer has left.
Open a file to view the comments.
You can either resolve a comment, or reply to it.
If the reviewer has left a suggestion, you'll see the diff between your code and suggested one and can either Apply locally (applies a patch to the working copy) or Commit (opens a commit message pop-up).
Both comments and suggestions are also displayed in the pull request timeline in the Info tab.