Git

Git is a version control system. It handles projects as repositories (often called repos) with a history. The history consists of commits. A commit is a change to the code with the description.

Git allows people to create forks of a repository. A fork is a new repository with the same history and content, but when committing to the fork, the main repository is not affected. This allows developers to work on projects without access to the main repo.

To bring other peoples work into the main repository, they can open a pull request. This can easily be done in the GUI of GitHub.

Git also has the ability to create branches in one repository. This allows developers to work on multiple features at the same time.

Minetest has two repositories: the engine is in the “minetest” repository, whereas the main game, Minetest Game, is in the “minetest_game” repositories. The repositories are hosted on GitHub.

Use Git to get the latest updates
You can use Git to get the latest updates of Minetest in a RUN_IN_PLACE version. To do this, clone the main repository:

To get the latest updates of the engine (you have to compile Minetest after this), do this in the cloned Minetest directory:

To get the latest updates of Minetest Game:

Creating a fork
To use Git for development, you have to fork the main repository on GitHub first. After this, you can clone your repository:

Coding a feature or a bug fix
Create a new branch to code your feature (be sure to give them good names (not just “patch” or “fix”)):

Now, you can code your feature or bug fix. If you are done, you have to commit your changes and push them to your repository on GitHub:

Commit messages should start with a capital letter and use the present tense. They should sum up the feature/fix.

You can now access your code in your repository on GitHub and open a pull request for it to the main repository.

To go back to your master branch do:

If you have to update your feature, do:

This will automatically be added to the pull request (if there is one).

Updating your fork
You can use Git to update your Minetest fork with the latest changes of the official repository.

Prerequisites
If you haven't already you need to tell git where to get the changes.

Updating the fork
You need to download the changes of the main repository first and then merge them.

For the engine:

For the game:

Tips
Simplify making commits: to make a commit, just do changes in your repository and run e.g. Quotes are not needed and the files (their path relative to the repository path) which are changed are annexed to the end of the commit message automatically.