Skip to content

Git Good at Git Setup

Atermonera edited this page Apr 15, 2018 · 3 revisions

This is a guide to learn how to get started with contributing to the code in as little time as possible. This guide uses the TortoiseGit client, which allows you to run Git commands without having to open a command line interface. Note that this means that this is a Windows only guide. If you are not using Windows, there are other Git clients that should work with your OS, with their own documentation.

Installation and Setup

Step 1 - Installation

First, we need to actually install Git itself.

  • Go here: https://git-scm.com/downloads
  • Download the Windows Git program.
  • You should leave all the settings to default when installing, if you're not sure what something does.

Step 2 - Register on Github

Now we need an account on Github. Fortunately, we can make a free account fairly easily. If you already have an account, you can skip this step.

  • Click Signup and Pricing
  • Choose the free account option.
  • Fill in your desired username/password and give it your email, verify it, etc. Done with step 2.

Step 3 - Configure Git

This part requires fiddling around with the console, however you only need to type a few lines in.

Open up Git Bash. If you did Step 1, you should have it installed. We want to tie your name to your commits, so type this in Git Bash. Replace "YOUR NAME" with your Github username. Make sure it is wrapped in quote tags.

git config --global user.name "YOUR NAME"

After that, we want to associate the email you gave Github to your commits as well, so type this. As previously, replace "YOUR EMAIL ADDRESS" with your email, wrapped in quotes.

git config --global user.email "YOUR EMAIL ADDRESS"

If you want your email address to be private, give this a read: https://help.github.com/articles/keeping-your-email-address-private/

Step 4 - TortoiseGit Installation

Now for the part we've been waiting for. We'll be able to do most things without needing to open a command line interface once we get TortoiseGit.

  • Go here: https://tortoisegit.org/
  • Install the latest stable release. Make sure to install the right program for your system (32 bit vs 64 bit OS).
  • While installing, make sure to select OpenSSH instead of TortoisePLink

Step 5 - Forking the Code

Now, we need a copy of the code that you can play with, first we need a fork.

  • If you haven't already, log into Github.
  • Go to https://github.com/PolarisSS13/Polaris
  • Click the 'Fork' button.
  • The page you should be redirected to is now your Fork, which is a copy of the code, that you will be pushing updates to later on, and making Pull Requests from here to the main server branch.
  • Copy the HTTPS URL of your fork, it should look something like https://github.com/NAME/Polaris , with NAME being your username.

Step 6 - Cloning

We have a nice fork with a copy of the code, but we actually need the code on your system in order for you to make changes. We're now going to make a copy of the copy of the source code .

  • Find a place on your system you don't mind your code sitting.
  • Right click and choose Git Clone…
  • The URL field should be filled with the URL of your Fork. If not, paste it in.
  • Click Next and watch flying tortoises bring you your code.
  • Depending on your connection speed, this could take awhile to download all of the source code. You might want to go get a snack or drink while you wait.

Step 7 - Setting up TortoiseGit

After we're done downloading the source, we need to do some one-time setup for TortiseGit.

  • Right click on the folder that was created (usually called Polaris), and go to TortoiseGit and then click on Settings.
  • Click on Remote under Git.
  • There should be one thing on the list origin. This is where your fork on Github is.
  • You're now adding the main repository as a source you can pull updates from.
  • In the Remote box type in upstream.
  • In the URL box put: https://github.com/PolarisSS13/Polaris.git
  • Click Add New/Save.
  • Click Ok.

Your 'upstream' remote should look like this picture below.

Your upstream should look like this.

Almost done!

Step 8 - Enabling the 'Merge Drivers'

This will reduce conflicts with .dmi and .dmm (icon and map) files. Technically optional, but highly recommended and quick to do.

  • Open the .git folder in your source code.
  • Open the file 'config' with a text editor (notepad might have issues, try notepad++ or your editor of choice).
  • Add the following to the bottom and save it.
[merge "merge-dmi"]
  name = iconfile merge driver
  driver = ./tools/dmitool/dmimerge.sh %O %A %B
[merge "merge-dmm"]
  name = mapmerge driver
  driver = ./tools/mapmerge/mapmerge.sh %O %A %B

When you pull code, it should first try to resolve any conflicts by using these programs. Without it, .dmi is especially vulnerable to merge conflicts.