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
- Fork the code
- Modify the code
- Test the code
- Submit a pull request
See next section for detailed steps.
Many of the guides in the internet will probably explain it better e.g. https://guides.github.com/introduction/flow/
Run the following to create a new branch and make changes as usual:
git fetch
git checkout master
- switch to mastergit reset origin/master
- update your local copy of master to match githubgit clean -f
git branch <new branch>
git checkout <new branch>
Go to https://github.com/Factorio-Biter-Battles/Factorio-Biter-Battles, then click fork.
- Go to your Factorio scenarios folder (try %APPDATA%/roaming/factorio/scenarios)
- Run
git clone <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
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: git@github.com:Factorio-Biter-Battles/Factorio-Biter-Battles.git
Push URL: git@github.com:<your fork>
If it's not like the above:
Set the fetch url
git remote set-url origin git@github.com:Factorio-Biter-Battles/Factorio-Biter-Battles.git
Set the push url
git remote set-url origin --push <your repo>
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
ormain
. You can also have multiple branches at the same time.
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
orgit 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"
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!
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