Skip to content

Latest commit

 

History

History
153 lines (114 loc) · 5.64 KB

contributing.md

File metadata and controls

153 lines (114 loc) · 5.64 KB

Contributing Guide

Table of Contents

Getting Started

Here is a guideline on how to get started!

We want to make contributing to this project as easy and transparent as possible, whether it's:

  • Reporting a bug
  • Discussing or Proposing new features
  • Submitting a fix

Reporting a bug

To report a bug:

  • Create a new issue on the Github Repo
  • Also mention it on our #suggestions-discussion discord channel (see instructions below)

Discussing or Proposing new features

To propose new features or discuss existing ones, please discuss in our discord channel

After some discussion, you can submit suggestions at #suggestions-discussion using the command: !suggest <suggestion description>

Vote in the #suggestions-list discord channel. See status in #suggestion-decisions (approved/denied/considered/implemented)

Submitting a fix

  • Fork the code
  • Modify the code
  • Test the code
  • Submit a pull request

See next section for detailed steps.


Beginner Guide - Contributing to the git repo

Many of the guides in the internet will probably explain it better e.g. https://guides.github.com/introduction/flow/

I've set it up before

Run the following to create a new branch and make changes as usual:

  • git fetch
  • git checkout master - switch to master
  • git reset origin/master - update your local copy of master to match github
  • git clean -f
  • git branch <new branch>
  • git checkout <new branch>

I'm setting it up for the first time

Create a fork

Go to https://github.com/Factorio-Biter-Battles/Factorio-Biter-Battles, then click fork.

Clone the repo

repo is the url of your fork which you can get from the green Code button in github.

You may want to change the name of the folder that resulted from git clone.
To test changes, create a new game using the scenario whose name matches the folder name generated by the git clone.
View Testing section for more details

Check your remote settings

Run git remote show origin which would show something like this
This uses SSH version which assumes that you have ssh keys setup.
The https urls should still work.

  Fetch URL: [email protected]:Factorio-Biter-Battles/Factorio-Biter-Battles.git
  Push  URL: [email protected]:<your fork>

If it's not like the above:

Set the fetch url

git remote set-url origin [email protected]:Factorio-Biter-Battles/Factorio-Biter-Battles.git

Set the push url

git remote set-url origin --push <your repo>

Branching

Create a branch: git branch <branch name>

Switch to your branch: git checkout <branch name>

Branches are a snapshot in time. You can break it as much as you want and can still switch to the original branch which is usually named either master or main. You can also have multiple branches at the same time.

Make your changes

Make your changes using your favourite editor

  • To see the list of files that you've changed: git status
  • To see the changes you've made: git diff or git diff <filename>

Stage your changes: run git add <filename> or git add . (to add all files with unstaged changes)

Commit your changes: run git commit -m "your custom commit message"

Testing

Open the Scenario locally and test your changes.

Run Factorio and select either:

  • Single Player > New game >
    or
  • Multiplayer > Host New Game >

Under User Scenario's select <my-BB-renamed-folder>

where <my-BB-renamed-folder> is the folder name that you changed the cloned version to.

####What should I test? You should test the code you modified to ensure it's working. Try get a friend to verify any multiplayer changes by asking for a hand in discord. Make sure to run the scenario and ensure it doesn't crash!

Submit a pull request

Once you are happy with your changes: run git push This will send the changes in your local branch to your branch in github.

If you get the error

fatal: The current branch <your-branch-name> has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin <your-branch-name>

Run the command git push --set-upstream origin <your-branch-name>

In your github repository, click Compare & pull request

  • base repository: Factorio-Biter-Battles/Factorio-Biter-Battles
  • base: master
  • head repository: <your-repo-name>
  • compare: <your-branch-name>

Write a small comment about your changes and Click Create pull request