Skip to content

Instantly share code, notes, and snippets.

@Darkhax
Created December 5, 2022 03:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Darkhax/e0e495f2f1adf8983199a30a96a34f50 to your computer and use it in GitHub Desktop.
Save Darkhax/e0e495f2f1adf8983199a30a96a34f50 to your computer and use it in GitHub Desktop.
Modding PR Guide

This guide contains some helpful information on how to actively contribute to mods. This guide is targeted towards contributors that may not have much technical experience and will only require the GitHub web UI. This guide is perfect for localizations, datapack changes, and other small scale changes. Larger code changes and experienced developers should not use this guide.

Forking the Mod

To start contributing to a mod on GitHub you need to fork it first. Forking a mod simply creates a copy of the projects code and assets that you can freely modify without directly affecting the original project. This can be done by signing in to GitHub, navigating to the repository page of the project you want to contribute to, and then clicking the Fork button on the top right of the page.

The fork button

Clicking the fork button will bring you to a "Create a new fork" page that allows you to configure your fork before creating it. Make sure the owner is set to your profile and that the "Copy the xxxxxx branch only" option is NOT selected if it asks. Click the "Create fork" button to finalize your config options and create the fork.

Keep in mind that a profile or organization can only hold one fork of a repository. If your profile is greyed out and has (fork already exists) next to it, you will not be able to fork the repository to that profile. To fix this you can delete that forked repository however this will also delete any changes you have made.

Explaining Branches

Branches are a way to separate and organize code in a project. It is important to have the right branch selected when editing files and submitting your pull request to avoid editing outdated or experimental files. This will also help avoid making invalid changes to the mod. While there are no universal standards mod developers will often use branches to seperate their code based on the Minecraft version or mod loader. For example 1.19.2 would have all the MC 1.19.2 code while 1.16.5-fabric would have all the code for the MC 1.16.5 Fabric version. The name main or master may also be used as a general catch-all for whatever the dev is actively working on. You can view the full list of branches from the main page of the repository by clicking the branches text. If the branch names are not clear you can always reach out to the author for more information.

Branches

Making the Pull Request

1. Create a new branch for your PR

Before working on your pull request it is recommended to make a new branch specific to your pull request that is based on the target branch. For example if you were adding German localization to 1.1.5 you should make a 1.16.5_german branch based on the 1.16.5 branch. This preserves the original branch as a clean branch that you can reference or rollback to later if necessary. This is especially important if you plan to make more pull requests to the same project in the future. Creating the new branch can be done by clicking on the branches text on the main page of your fork and then clicking the "New Branch" button. From here you can select the target and write the new name.

Create Branch

Once you have created your new branch select it on the branch drop down menu. Once this has been selected you can only view and edit the files that are part of that branch. You can also add any files you want using the web editor. Select Branch

2. Add and Edit files

Adding files can be done using the "Add file" button. Selecting the "Create new file" option will let you write a new file using the web editor while selecting the "Upload files" option will allow you to upload files that you wrote on your computer. It is very important to make sure your files are being created in the right place. The location of the file can be checked by looking at the file name area.

Create File Example

Editing existing files has a similar process. You need to find the target file within your fork and then edit it by clicking the pencil button. Edit File

3. Commiting Files

To save your changes you need to create a commit. This will create an entry in the commit history that shows what you did and how it was done. It is best practice to write a descriptive message for each commit. This should not be uneccesarily long but avoiding stuff like "update" or "made changes" should be avoided.

4. Open Pull Request

Opening a pull request allows you to submit your changes back to the base project. This is done by clicking on the pull request tab of your fork, clicking the "New Pull Request" button, and then selecting the target branch on the left and your modified branch on the right. Once both branches have been selected you will see a list of all your new commits and file modifications that you are about to submit. If these look correct click the "Create pull request" button. Make sure to give your pull request a relevant name and description to help the author know what the goal and motivation of your pull request is. preview changes

5. Merging Pull Requests

After opening a pull request it is up to the project owner to decide if they will accept it or if further changes are required. If they request changes you can edit your branch and the changes will carry over to your pull request automatically.

Syncing Your Branches

Changes made to the base project will not automatically carry over to your fork. This means that if the developer makes any commits on their own or merges another pull request your fork will become desyncronized from the base project. This can result in. TBD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment