Guide to git

From BeeStation Wiki
Revision as of 13:00, 12 September 2013 by imported>Jordie0608 (Added links to coderbus and Erro's video guide)
Jump to navigation Jump to search

This guide uses TortoiseGIT. While there are other programs out there, this one is the most commonly used. This guide is for Windows only.

If you are having trouble

Watch this video guide if you are having difficulty with any step below. [1] If you have further problems, contact someone on #coderbus

Step 1 - Install Git

  • Go here: http://git-scm.com/downloads
  • Download the Windows Git program.
  • It should look something like 'Git-1.7.11-preview20120620.exe'
  • Install it and leave everything on default (just keep clicking next).
  • Wait till the installer has finished.
  • Step 1 over!

Step 2 - Register on Github

  • Head over here: https://github.com/
  • Click Signup and Pricing in the top right-hand corner.
  • Click the Create free account button'.
  • Create an account with your username and email.
  • Done!

Step 3 - Configure Git

  • Head here: https://help.github.com/articles/set-up-git
  • Follow the guide above, it's pretty straight-forward.
  • Now you have Git all setup, but if you're command line illeterate like me, you'll wanna have some fancy graphics!

Step 4 - TortoiseGit

Step 5 - Forking Code

  • Head over to: https://github.com/tgstation/-tg-station
  • Click the Fork button in the top right corner.
  • Experience hardcore forking action.
  • The page you'll be directed to is now your fork. You'll be pushing updates here, and making pull requests to have them merged the the main (master) repository.
  • Copy the HTTP URL. It's next to the HTTP GIT and Git Read-Only buttons. It'll look something like: https://github.com/NAME/-tg-station.git

Step 6 - Downloading the Code

  • Find a place you don't mind the 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.

Step 7 - Setting up TortoiseGit

  • Right click on the folder that was created (usually called -tgstation), and go to TortoiseGit and then click on Settings.
  • Click on Remote under Git.
  • There should be one thing on the list origin.
  • You're now adding the main repository as a source you can pull updates from.
  • In the Remote box type in upstream (or whatever you like).
  • In the URL: box put: https://github.com/tgstation/-tg-station.git
  • Click Add New/Save.
  • Click Ok.
  • Almost done!

Step 8 - Updating your Repo

  • Updating your repo with the master should be done before trying anything.
  • Right-click the folder your repo is in and select TortoiseGit then Pull.
  • Click the radial button next to Remote and make sure upstream (or whatever you called it) is selected next to it.
  • The remote branch should be set to master.
  • Then click Ok. This will pull the latest changes from the master repo.

Step 9 - Making a Branch

  • Branching your repo is very important for organising your commits, you should have a different branch for each unrelated code change (e.g. if you wanted to make some new sprites for one item and change the properties of another these should be in seperate branches), as Pull requests work off branches rather than commits this will allow you to make a seperate Pull Request per change. Doing this streamlines the whole process and will save everyone a bunch of headaches.
  • Right-click in your working folder. Then choose TortoiseGit, and Create Branch...
  • Type in your new branch name
  • (Optional) Tick Switch to new branch
  • Press Okay and your new branch is created

To switch between Branches:

  • Right-click in your working folder. Then choose TortoiseGit, and Switch/Checkout...
  • Choose your Branch then press Okay

Step 10 - Making a Commit

  • A commit is confirmed change of the files in your repo, it's how you make changes permanently to the files in your repo, so try not to commit without making sure it works (though subsequent commits can fix it).
  • To make your commits, you need to edit the files using BYOND's inbult editing tools. These won't be discussed here, there are plenty of other guides! Then, when you're finished, right click the folder you're working with and choose Git Commit -> "master"
  • You can then select only the files you want to be committed by ticking or unticking them. You should also write a detailed commit summary, detailing what happened in that commit.
  • Click Ok and the commit will be committed to your local repo!

Step 11 - Making a Pull Request

  • Right-click in your working folder. Then choose TortoiseGit, and Push...
  • Set Local: and Remote: to master
  • Under Destination, set Remote: to origin.
  • Click Ok. This'll upload your changes to your remote repo (the one on GitHub).
  • Head to your GitHub repo e.g https://github.com/NAME/-tg-station.git
  • Click Pull Request at the top right.
  • Fill out a summary and then create the pull request.
  • You're done!


Contribution guides
General Development, Downloading the source code / hosting a server, Guide to git, Game resources category, Guide to changelogs
Database (MySQL) Setting up the database, MySQL
Coding Understanding SS13 code, SS13 for experienced programmers, Binary flags‎, Text Formatting, Guide to signals
Mapping Guide to mapping, Map merger, Exploration Ruins
Spriting Guide to spriting
Wiki Guide to contributing to the wiki, Wikicode