Table of Contents
Git Usage
Forking
MassiveCraft uses its own Gitlab instance for its plugins, so if you’re looking to make your own changes you’ll likely want to import the repo elsewhere – I.e. Github.
Contributors within the MassiveCraft team will be given accounts on our Gitlab instance where they’ll be able to have their own fork, and create Merge Requests.
Using Github, for example, you can go to https://github.com/new/import and provide the Repository URL – i.e. https://gitlab.massivecraft.team/massivecraft/MassiveCore.git. You will not need a username or password to do so for our Open-Source plugins.
You can then clone the repository from your own remote fork, and push your changes back as needed.
Cloning
Whether you’re using a fork as mentioned above, or cloning directly from the MassiveCraft Gitlab, this process will be fairly similar.
Copy your Repository URL, I.e. https://gitlab.massivecraft.team/massivecraft/MassiveCore.git
or [email protected]:yourname/MassiveCore.git
If you’re working with multiple MassiveCraft plugins, we recommend keeping these together in a shared Workspace folder.
Open your git terminal and go to the Eclipse workspace directory where all projects are stored. Then execute the following commands to download and setup your fork.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# cd to your MassiveCraft workspace folder. For example... mkdir -p ~/Workspace/MassiveCraft cd ~/Workspace/MassiveCraft # Clone your repo. I.e. MassiveCore git clone git@github.com:yourname/MassiveCore.git cd MassiveCore # If you've cloned directly from out Gitlab, you may want to add it as an upstream remote git remote add upstream https://gitlab.massivecraft.team/massivecraft/MassiveCore.git # Then checkout the Branch for your version git checkout Birb-Dev/1.21 |
Recommendations
Branching
Before you start coding you should create a new branch. We discourage working on the master branch because you might want to work on multiple features at once. Each feature should have it’s own branch to keep things separated and avoid confusion.
1 2 3 4 5 6 7 8 9 10 11 |
# Create your new local branch git branch feature/your-new-feature # Checkout your local branch git checkout # Or you can create and checkout in one go git checkout -b # Push your local branch to remote git push -u origin |
Committing
When you have made your changes and think they are ready to be pulled you should create a commit.
1 2 3 |
# Alternate version allowing message from command line git commit -m "Your message goes here." git push |
Rebasing
While you work on your commit other commits are probably pulled into upstream, leaving your work a bit outdated. So before requesting that your commit be pulled you should “rebase” which is a form of update. Rebasing is painless most of the time but sometimes you will have to do some manual conflict resolution if another commit changed the same files as yours.
1 2 3 4 5 6 7 8 9 10 11 |
# Fetch all remote repositories git fetch -all # Check out your branch git checkout feature/your-new-feature # Perform the rebase git rebase upstream/master # Force push the changes made by the rebase git push --force |