Guide to Git CLI
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 https://git-for-windows.github.io/ and come back here.
For GNU/Linux or other Unix OSses: Instructions can be found here: https://git-scm.com/download/linux.
For OS-X : Download can be found here: http://git-scm.com/download/mac.
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.
- Go to the /vg/station13 Github repository.
- Log in.
- Press fork. Let it finish.
- Copy the HTTPS link in your newly created fork to your clipboard (should be on the right)
- Open the command line. If you are on Windows, do Windows Key + R and run
Git Bash. Pin this to your task bar because you're going to be using it a lot.
- 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.
- Save the repository wherever it decides to put it. This will give you quick access through the command line.
- 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_OPENto 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,
- 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 :
git statusto make sure you are on Bleeding-Edge. If you aren't, you fucked up already. Congratulations.
- Once you are, do
git branch NAME_OF_YOUR_BRANCH. This will create a new branch that also contains everything in Bleeding-Edge
git checkout NAME_OF_YOUR_BRANCHto switch to your newly created branch.
- Open Dreammaker and start ruining the code.
"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/setup.dm, and it doesn't compile anymore.
Open your trusty CLI and run the following command:
git checkout HEAD code/setup.dm
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.
- Close Dreammaker after having saved all your really good code.
- On the command line, do
git status. A lot of red lines are going to pop up, that's normal, don't panic.
- 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_FILEuntil all the files you want are in
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.
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.
- 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
git status. If you see anything left in your repository that you don't want with your pull request, do
git checkout .
- If the evil, evil coders tell you that your code is shit and want you to change stuff, do
git checkout NAME_OF_YOUR_BRANCHand re-open Dreammaker, repeat the whole process.
Updating your repository
An easy way to update your repository is the following :
- 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)
- Copy the main repository's HTTPS link to your clipboard
git remote add remote HTTPS_OF_MAIN_REPO
- 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
- 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"
git statusfor damage report.
- If you have already committed changes, do
git reset HEAD~1to unstage all the changes in the previous commit.
- 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.
git checkout NAME_OF_YOUR_BRANCH. Damage Control successful.
"Oh no, conflicts !"
- 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.
- 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.
- Go check the conflicting file on the main repository for yourself. Either way, to reproduce your changes, it will be wiser.
git rebase -X theirs Bleeding-Edge.
git push -f origin NAME_OF_YOUR_BRANCH.
- 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.
- Push that, damage control successful
|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|