Setting up git
This guide uses Git BASH. While there are other programs out there, this one is objectively better.
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.
Step 3 - Forking Code
- Head over to: https://github.com/HippieStation/HippieStation
- Click the Fork button in the top right corner.
- 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 main (master) repository.
- Copy the HTTP URL. It'll look something like: https://github.com/NAME/HippieStation (if you forget it, attempting to create a fork again will remind you and give you a link to the already existing one).
Step 4 - Downloading the Code
- Find a place you don't mind the code sitting. Keep in mind the code isn't light, it should be around 3,5 GBs. Be sure to have enough space.
- Right click and choose Git Bash Here (To paste things in the command prompt, you can rightclick->paste. Ctrl+V and related do not work, since they're hotkeys for special commands).
- Execute this command by writing it without the "s then pressing enter: "git clone YOURURL", with YOURURL being the HTTP URL we fetched in the previous step.
- Once it finishes downloading, execute: "cd HippieStation" and you will be moved to the folder with all the game code. You can also notice a (master) in cyan being added to the location you're in.
Step 5 - Setting up remotes
- Execute "git remote add upstream https://github.com/HippieStation/HippieStation" to add our repository as upstream, so you will be able to keep your repo up to date. This will be used in commands later on.
- (OPTIONAL) If you want, you can also set up a tg remote, in case you are gonna help with mirrors in particular, or anything else. "git remote add tg https://github.com/tgstation/tgstation"
Step 6 - Updating your Repo
- Updating your repo with the master should be done before doing anything, especially creating new branches.
- With Git BASH opened in the code location (either from the previous step, or you can just go in your HippieStation folder and do rightclick->Git Bash Here):
- Be sure that you are on your master branch (the cyan text between parentheses at the end of the path). If not, execute "git checkout master".
- Execute "git fetch upstream".
- Execute "git rebase upstream/master". It should say "Current branch master is up to date." since you made the fork just now.
Step 7 - 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.
- From master branch, execute "git checkout -b yourbranchname". This will create a new branch called yourbranchname (you can choose any name) (thanks to the -b flag), and switch to it automatically.
- You can switch between branches with "git checkout branchname", just like we did before with master. Now that you are in your newly created branch, go code and make whatever change you need, then go to step 8.
- If you are in need to delete branches, switch to master branch and execute "git branch -d branchname". This will delete your branch, as long as you didn't do anything with it. If it fails, it should tell you the syntax to force delete it, although you will lose any code change you did on said branch. Don't delete "master", not sure if it's even possible but don't. // TODO: add command to force delete branches
Step 8 - 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).
- As said before, you should use different branches to separate your commits/changes. Don't commit to master. It should be clean, so you can fall back on it if needed.
- To make your commits, you need to edit the files using BYOND's inbuilt editing tools. Make sure to follow coding standards when making your changes!
- When you're finished, in Git BASH execute "git status" , this will show you all the changed files in red, so you can be sure you changed whatever you wanted changed.
- If you want to quickly add all the changed files to the index (aka marking them to be committed), simply run "git add ." or you may just add certain files by doing "git add FILEPATH", filepath being the one git status shows you.
- After adding the wanted files, you will notice that by running "git status", they will be green now. You can now pack them up into a commit,which will be the one we'll make the pull request with.
- Execute "git commit -m "commit title here" ". Be careful, the inner "s are actually needed. For example, if I want to make a commit named pasta boy, I will run: git commit -m "pasta boy"
Step 9 - Making a Pull Request
- After committing, you will have to send the changes to github, since right now they are still only on your computer.
- To do so, simply run "git push --set-upstream origin yourbranchname". It will send the changes, and now you can close Git BASH, since we'll have to move on github again.
- Go on our repository again, and after a few seconds, a yellow label with a green button should appear. Click it, and it will open the create pull request page.
- In case said label doesn't appear for whatever reason, simply "New pull request" instead. You will have to specify your fork and your branch, and you'll have two dropdown windows.
- Set the one on the right to your fork (NAME/HippieStation), and set the branch to the one containing your changes. The page may reload while you do so.
- Set the one on the left to HippieStation/HippieStation (like the one on the right). Leave the branch to master. Now it should display only your changes, properly, on the bottom of the page. Quickly look if they're correct, and if they are, click "Create pull request".
- Fill out title and summary, be sure to choose a fitting title, write a good summary and be sure to include the changelog in it properly, as the example already in the field shows you. What matters for the changelog is the :cl: and /:cl: tag, along with the text inbetween. Be sure to write a summary of what your PR does, to make the maintainers' job easier.
- Press "Create pull request" and you're done! In many cases there will be issues pointed out by other contributors, unfortunate merge conflicts, and other things that will require you to revisit your pull request.
If you are having trouble
If you have further problems, do not be afraid to contact someone on our discord.