Contributor_Guide - Khaira-Hol/GS13-Citadel GitHub Wiki
Note: This guide is very minimal and in-work.
This is a basic contributor guide to the GS13 repo. Below outlines the process for pulling the repo, keeping your local repo up-to-date, pulling the latest changes, making a branch, committing changes, and pushing to your branch.
Knowing these concepts is great if you want to start modifying features, fixing bugs, or contributing sprites! Currently, this guide focuses on git operations done via the command line, but steps and explanations for GUI operations may come soon.
Downloading a copy of the repo onto your machine to modify and work in is called "Cloning" in git-land.
Open a command line, navigate to a directory you'd like to store the repo's contents in, copy/paste the following line, and hit enter:
git clone https://github.com/Khaira-Hol/GS13-Citadel.git
Alternatively, if you'd rather avoid the command line (for now), navigate to the repo's home page, click the green Code <>
button, and click Download ZIP
. When the zip finishes downloading, unzip it in your work directory of choice.
Your most important tool for knowing the status of your remote repo is:
git status
This will tell you if you made any changes to your local repo, what files were changed, if you have changes staged, and what branch you are on. Check this to make sure you push to your own branch instead of master
by accident.
Example: A clean branch
PS D:\SS13\GS13-Citadel> git status
On branch oreo-shake
Your branch is up to date with 'origin/oreo-shake'.
nothing to commit, working tree clean
Periodically, it helps to call git fetch
to check for upstream changes. This is good to do while on master
before you create a new branch.
⚠ Be extra sure you are pushing to your own branch! Pushing directly to master is no good, and will likely fail thanks to our security features.
Checking out branches, AKA "changing" branches, is a fundamental git operation you'll use frequently. When you first clone the repo, your branch will be set to the default branch, which for GS13, is the master
branch. To change to another branch, utilize:
git checkout <branch_name>
You can get a list of origin branches (branches on the repo) to pull by typing git branch -r
. Local branches can be listed with git branch -l
, and both can be listed with git branch -a
.
To make a new branch, you can utilize one of two methods:
- Regular method:
git branch <branch_name>
- Quick method:
git checkout -b <branch_name>
What's the difference? Both create a new branch HEAD
(start point on the git tree), but the "quick method" automatically switches you to the new branch.
When it comes to pulling a branch (copying someone's work into your local repo), your most common use case will be pulling master
before creating a new branch or pulling a buddy's branch for testing and help. To pull a branch, first checkout
the branch, and then type:
git pull
You are now on the latest version of the remote branch you checked out. Don't specify the branch name in the above command.
Note: If the branch you want to pull doesn't exist after a git branch -r, enter git fetch. If it still doesn't exist, ask someone if that branch was sent upstream to the origin in the first place.
When you are done with your work, go ahead and run:
git status
As stated above, this tells you about any changes you've made on your branch. Verify everything listed is indeed something you touched.
Example: git status output after modifying a file
PS D:\SS13\GS13-Citadel> git status
On branch master
Your branch is up to date with 'origin/fake-branch'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: code/game/objects/effects/anomalies.dm
no changes added to commit (use "git add" and/or "git commit -a")
You can dive into the specifics of what you modified by typing:
git diff
This will print out each individual line change you made per file. To exit this mode, type q
.
Example: git diff output. All I did here was insert two newlines.
diff --git a/code/game/objects/effects/anomalies.dm b/code/game/objects/effects/anomalies.dm
index e8f83bd0c9..830b909db7 100644
--- a/code/game/objects/effects/anomalies.dm
+++ b/code/game/objects/effects/anomalies.dm
@@ -21,6 +21,8 @@
var/core_drop_chance = 100
/obj/effect/anomaly/Initialize(mapload, new_lifespan, core_drop_chance = 100)
+
+
. = ..()
GLOB.poi_list |= src
START_PROCESSING(SSobj, src)
~
~
~
~
Now that you've figured out what files you want to commit, you must add them to your commit. This can be done in two ways:
- By file:
git add <file_path>
-
Given the first
git status
example in this section, you would type:git add code/game/objects/effects/anomalies.dm
-
- Add Everything:
git add *
Now, these changes are "staged" for a commit. Part of the magic of git is the ability to create a "paper trail" of your and other contributors' work, so you will want to utilize the -m
option to include a commit message. Keep this succinct and under 72 characters.
git commit -m "My commit message."
And now, for the final step. This is your last chance to make sure you're pushing to your branch, and not master! You may now push
your branch to the repo. Type:
git push
And that's it...unless this branch doesn't exist on the remote. If it doesn't, git will tell you that it doesn't know what remote branch to push it to, and offers a simple solution:
git push --set-upstream origin <branch_name>
Make sure the <branch_name>
above matches your local branch name to save yourself a headache. Now you are done. Thank you for your contribution!
Coming Soon: Pull Request Process, GUI Instructions, Special Cases, Advanced Techniques, Rebasing, Merging