D00Med / farlands

Steampunk/fantasy themed subgame with dinosaurs
29 stars 11 forks source link

A little git guideline #170

Open MarkuBu opened 6 years ago

MarkuBu commented 6 years ago

This issue should help you develop with git. I will use commandline commands. If you use a GUI you shoud execute the corresponding function.

The most important rules:

  1. Don't touch the master branch
  2. Create a branch for each subproject. For example: If you want to add item frames, create the branch "add_itemframes", if you want to add new biomes create the branch "new_biomes"
  3. Don't edit files that are not related to the topic of the branch. For example: don't edit files in the farming mod if you add flowers in the flower mod, except it is necessary for the flowers project.
  4. Don't edit the default mod or other mods from MTG, except it is absolutely necessary, for example deactivate an ABM. Don't add or remove files from MTG

To reduce issues while merging, talk to the other devs. It helps if two people never work on the same file. If possible always work in a separate mod.

First read Getting Started - Git Basics. This helps to understand how git works

To create a new branch use the checkout command. Make sure that you are at the master and pull the latest updates before checkout a new branch

git checkout -b "your_project"

To check if you are in the correct branch use

git status

To change the branch use the checkout command, but without -b

git checkout "your_project"

Create and edit you files as usual. To add your changes use the add command. For example

git add README.txt

You can add all changes at once like this

git add .

If you are happy with your changes create a commit with a message, that gives a short explanation what you have done.

git commit -m "Fixed some typos in README.txt

Use git commit frequently to keep track of your work. That makes it easier to go back to a working state, if you messed up things.

Read Undoing-Things how you can repair your mess ;-)

Important: if you want to switch to another branch you need to commit first

Use git status frequently to check the status of your branch

With a commit nothing is moved to the server. To publish and share your work with others use

git push origin your_project

If everything is tested and works you can merge your branch to the master. First you need to checkout to the master and make sure that the master is up to date

git checkout master
git pull
git merge your_project

Make a test with the master before you push everything to the server

Read Basic Branching and Merging. It is helpful to understand how branching and merging works

D00Med commented 6 years ago

Thankyou for this!

Xaleth commented 6 years ago

All I do after I finish editing, I type:

git add -A git commit git push

inside the root directory of my fork of the non-master branch.

MarkuBu commented 6 years ago

Yeah, but please add a message to each commit

Xaleth commented 6 years ago

I'll do that.