You must register an account to edit pages.

Guide to Git CLI

From /vg/station13
Jump to: navigation, search

So, you want to code, you're wise enough to not install that disaster that is the Github Native App but you can't manage to get TortoiseGit or SmartGit running with all its dependencies ? Welcome to the Command Line Interface

For Windows users : Bill Gates couldn't bother to package Git with your spyware suite, go do and come back here.

For GNU/Linux or other Unix OSses: Instructions can be found here:

For OS-X : Download can be found here:

Setting up your repository

First of all, you're going to need a fork of the /vg/station13 repository like everyone else. Either way, you're not getting access to the main repository, you're going to fuck up.

  1. Go to the /vg/station13 Github repository.
  2. Log in.
  3. Press fork. Let it finish.
  4. Copy the HTTPS link in your newly created fork to your clipboard (should be on the right)
  5. Open the command line. If you are on Windows, do Windows Key + R and run cmd or Git Bash. Pin this to your task bar because you're going to be using it a lot.
  6. Type in git clone . Do "ALT + Spacebar" to access the command line options, and do "Paste" so that you don't have to type out the link like a peasant.
  7. Save the repository wherever it decides to put it. This will give you quick access through the command line.
  8. Go live your life while it clones, it's going to take a while, especially if you have a third world connection.

Note : Hitting TAB will auto-complete commands. Results may vary.

Using your repository

Now, you are going to need to learn how to be a world elite command line hacker. You only need to remember a single command to actually access your repository through the command line :

  • cd FOLDER_TO_OPEN to open a folder. cd ../ if you fucked up and need to go back

You don't even need to figure out how to check the folders in your location because you can just use the file browser. Now, we just need to learn git

Note : You need to be in your repository to use most git commands. If it whines about unrecognized commands and it's not clearly a git error, you aren't in your repository.

  • To see what is going on at any time, do git status. This is the closest thing to an interface you are going to get. When in doubt, git status.
  • To see what branches are in your repository, do git branch. This is useful if you can't seem to find that branch you were working on.

Now, we are going to create a new branch so that we can start ruining the code :

  1. Do git status to make sure you are on Bleeding-Edge. If you aren't, you fucked up already. Congratulations.
  2. Once you are, do git branch NAME_OF_YOUR_BRANCH. This will create a new branch that also contains everything in Bleeding-Edge
  3. Do git checkout NAME_OF_YOUR_BRANCH to switch to your newly created branch.
  4. Open Dreammaker and start ruining the code.

Reverting files

"Oh no! I accidentally ruined this file!"

Fear not, because Git is great fixing files is a piece of cake. You can revert files to how they were in the last commit by using git checkout HEAD path/to/file

So, let's pretend you accidentally deleted half of code/, and it doesn't compile anymore. Open your trusty CLI and run the following command: git checkout HEAD code/

Making a Pull Request

Congratulations, you didn't stub your toe while coding and now you're back. Now, we have edited and saved a lot of shit in Dreammaker, and we want to package all of this neatly so that we can ruin the code as soon as possible.

  1. Close Dreammaker after having saved all your really good code.
  2. On the command line, do git status. A lot of red lines are going to pop up, that's normal, don't panic.
  3. Check the changes that have been registered one by one. If everything is correct, do git add --all, otherwise do git add FULL_PATH_OF_CORRECT_FILE until all the files you want are in
  4. Do git commit -m "WHAT_I'M_RUINING_TODAY". This is your commit, and the title of it will be used for the title of your pull request.
  5. Do git push origin NAME_OF_YOUR_BRANCH. You will have to log with your Github credentials, otherwise you won't be allowed to push to your repository because HTTPS is not secure.
  6. Switch over to the Github website and create a Pull Request. Tweak the Title, add a full description so that people know what the fuck you just did, and check the changelog. Then open your pull request
  7. Do git status. If you see anything left in your repository that you don't want with your pull request, do git checkout .
  8. If the evil, evil coders tell you that your code is shit and want you to change stuff, do git checkout NAME_OF_YOUR_BRANCH and re-open Dreammaker, repeat the whole process.

Updating your repository

An easy way to update your repository is the following :

  1. Go to the main repository (If you really have trouble finding it, go to your Github fork and find where it says "Forked from d3athrow/vgstation13", click that)
  2. Copy the main repository's HTTPS link to your clipboard
  3. Do git remote add remote HTTPS_OF_MAIN_REPO
  4. Once that's done, do git checkout Bleeding-Edge (Make sure you don't have unstaged changes, or it's going to trash them) and then git pull remote Bleeding-Edge
  5. Once the changelog is done scrolling, do git push origin Bleeding-Edge. Log in with your Github credentials. Your local repository and your fork are now updated. Isn't that swell ?

Unfucking your Pull Requests

"Oh fuck, I accidentally coded on Bleeding-Edge"

  1. Do git status for damage report.
  2. If you have already committed changes, do git reset HEAD~1 to unstage all the changes in the previous commit.
  3. Stage all the changes you're going to keep with git add --all. Failure to do so will cause all your hard work to go into the bin when you checkout a new branch.
  4. Do git checkout NAME_OF_YOUR_BRANCH. Damage Control successful.

"Oh no, conflicts !"

  1. Make sure your Bleeding-Edge branch is updated. This obviously means you need to stage or commit your changes if you have any, because you're about to checkout Bleeding-Edge.
  2. Checkout the branch which is in a conflict situation. Do git rebase Bleeding-Edge. It's going to scroll a bit and throw an error in your face. Note what is conflicting and do git rebase --abort.
  3. Go check the conflicting file on the main repository for yourself. Either way, to reproduce your changes, it will be wiser.
  4. Do git rebase -X theirs Bleeding-Edge.
  5. Do git push -f origin NAME_OF_YOUR_BRANCH.
  6. Redo your changes on the files that were conflicted. If the conflicting change wasn't a dirty edit, don't just copy-paste over it.
  7. Push that, damage control successful
Contribution guides
General Downloading the source code, Guide to contributing to the game, Game Resources category
Coding Understanding SS13 code, SS13 for experienced programmers, Binary flags‎
Mapping no other guides
Spriting no other guides
Wiki no other guides