Welcome! It's very nice of you to express such interest in us. This document will walk you through every step required to become a functioning contributor to the Legalese open-source effort.
Naturally, different people will be able to start at different points in the guide: if you find that you've done all the work in one step, feel free to skip to the next one (duh).
NOTE: It is still vitally important to read every step. There may have been something you missed, and we'd like all of you to be equally up to date and ready.
- When there is a PLUS sign (
+
), it is an ADDITION sign: do BOTH this AND this. When something likeCommand + Spacebar
comes up, it does not mean press the Command key, Plus Key and Spacebar Key. It means press the Command and Spacebar keys together. - A REPOSITORY is a collection of code on GitHub that's organised into a distinct entity for a specific purpose. Think of it like a project or a collection of paperwork for a business deal.
- Text highlighted in
grey
iscode
. When there are instructions to type in something that is highlighted ingrey
, copy and paste exactly as it is typed. Do not omit spaces. When I say type ingit clone
, I mean type ingit clone
with the space at the end. - The instruction to RUN an instruction means to type that instruction into your Terminal, and press the Enter key. For example, the instruction to run
ls
tells you to type inls
in your Terminal, and to press the Enter key afterwards.
Most of our work is here, on GitHub. GitHub helps us keep track of who's done what, store different versions of our documents, and hosts the source code for our projects.
So you'll need an account to start contributing changes to our code!
-
On GitHub, click Sign Up. Use whichever email you'd like, and set a password and username.
-
The next page says 'Verify Account'. Click Create Account.
-
Choose the Free plan. Click Continue.
-
Answer the profile questions on the next page if you like.
-
You now have a GitHub account! Nice.
- Email [email protected] or ping him on #ikm on Slack to add you as a contributor. You'll need that particular role to make changes to our code later.
Welcome to Git! It's a version control software (something like Word's track changes, but like a thousand times more powerful).
You'll need to have Git on your computer to work on our files.
- Open the Terminal program. It will be in your Applications folder. Alternatively, pressing Command + Spacebar will bring up Spotlight, and just type 'Terminal' in there, and press Enter.
- This opens a terminal prompt, and you should see a flashing cursor in the new Terminal window.
- Run
which git
. - You should see something like
git is /usr/local/bin/git
- Congratulations, you have Git. If you don't, you won't see any message like the above printed out, and instead your cursor will travel to the next line with no output.
a. In this case, visit Git, which should have a Download For Mac button somewhere near the bottom right. Follow the instructions from the installer.
b. Quit your Terminal with Command + Q, and open it again. When you run
which git
, it should show you the message printed above.
- Git for Windows is your best bet. Download it and install it.
- For the purposes of the rest of this README, whenever there's a reference to a command run inside the Terminal, you'll do the same inside your Git Bash terminal.
SSH keys are basically personal identification bits of code that tell GitHub that yes, it is really you trying to make some changes to code on GitHub. You need to set up your SSH keys so that you can make changes to our code.
Visit these pages in order, and follow the instructions on them EXHAUSTIVELY. Do not skip any step.
Don't skip steps. I'm serious.
- https://help.github.com/articles/checking-for-existing-ssh-keys/ - this will help you check whether you already have a key ready for use.
- https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ - if you don't, create one and add it to your key-agent. This is sort of like adding a visa stamp to your passport.
- https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/ - add that key to your account.
Congratulations, you can now identify yourself with GitHub from the Terminal!
You're not going to be working in Word: you'll need a text editor.
I recommend Atom, because it's fuss free. Go download and install it.
- Navigate to the correct repository. As an example, we're going to use the repository that contains code for Legalese's website: legalese.github.io.
- On the right-hand-side of the screen, there should be a bright green button that says Clone or download. Click it.
- A little popup should be displayed.
a. Does the title say Clone with SSH? Copy the text in the field, which should look like this:
[email protected]:legalese/legalese.github.io.git
b. Does the title say Clone with HTTPS? The text in the field is not what we want. Click on Use SSH in the top right hand corner of the popup, and follow step 3a. - Go back to your Terminal window. Type
git clone
, and press Command + V to paste the copied text from step 3a. Press Enter. - There should be some 1337 goings-on in your Terminal that tells you something is cloning something. Enjoy the show, it's going to take a while for this repository (there's a lot of images). Feel free to alt-tab out and do something else.
- After two minutes or so, go back to your Terminal window. There should be a
done
somewhere. If there isn't,git
isn't done. If there is, you've just cloned (downloaded) our website code! - Open up Atom, or another text editor that you chose. Feel free to open the files and examine them: your
legalese.github.io
folder should be in your Home folder on Mac, or your User folder, on Windows.
- We're going to learn a new command here for the Terminal called
cd
. It lets you change your directory location in your Terminal, in very much the same way you navigate up and down your Dropbox folders in Finder or Windows Explorer. - We invoke
cd
with something called an argument: we tellcd
where we want to go. In this case, we want to go into the folder that contains the Legalese website code you just cloned in step 5. - Since the name of the repository is
legalese.github.io
,git
has by default cloned it into a directory calledlegalese.github.io
. To get into that folder, we simply runcd legalese.github.io
. - The second new command we will learn is
ls
.ls
tells us what is in the folder we're currently in. - Run
ls
. We now see a list of files. Most of them end in.html
, because that is the file format for webpages. - How do we go back up to the previous folder? We run
cd ..
...
means the parent folder of whichever folder you're in.
For contributors, we don't automatically accept all the changes you make: there's a review process called a pull request, where you submit some code for review before we absorb them.
How do you make a pull request?
- To prevent changes you make from affecting our code before we accept it, we use the power of Git, and the idea of branches. Essentially you work on a separate version of the code and make changes there. When you submit a pull request, we can see the changes you've made, and if we approve it, we can merge your changes back into the
master
branch - the canon. - For contributors, you'll be working on the
contributors
branch. Go back to your Terminal window, and go back to yourlegalese.github.io
folder. a. If you can't find it, runcd
. Then runls
. These two steps made you go back to your root directory (which is the Home folder on Mac/User folder on Windows), which contains yourlegalese.github.io
repository. Then runcd legalese.github.io
. You're now in your local copy of the repository. - Run
git status
. It should say something likeon branch master
. This is holy canon. Do not make changes to the holy canon. Make changes to thecontributors
branch. - To switch branches, run
git checkout contributors
.git checkout
tells git to switch branches to the argument coming afterward, which in our case will becontributors
. a. Is there an error which tells you that Git can't find a branch calledcontributors
? It's @jobchong's fault. Email him at [email protected], or message him on Slack. He will create the branch for you to work on. Feel free to snigger at his incompetence. - Once you've checked out
contributors
, you need to rungit pull
. This pulls the latest changes to the code from GitHub. - Then run
git rebase master
. This bases thecontributors
branch on themaster
branch, which keeps it up to date on the latest holy canon. - Open up your text editor, and make whatever changes necessary. Save your changes.
- We're now going to make a commit - essentially a note in the history of the repository that says, at this date, Contributor made this changes.
- Go back to your Terminal window. Run
git add .
. This tells Git to notice all your changes and add them to the commit you're about to make. - Type
git commit -am
, and after that space type in your commit message. Keep it short and sweet and as descriptive as possible: for example, 'Corrected typos in the LegalTech Industry section'. Press Enter. - Run
git push origin contributors
. Agit push
tells Git to push your changes to GitHub, so that other people can see them and include them in their work too. a. If this is your first time runninggit push
, you need to rungit push -u origin contributors
instead. - Go to the
legalese.github.io
repository on the GitHub website. Click New pull request. - Click on the compare: box to the right, and select the contributors branch.
- The title of the pull request should be automatically your commit message. Feel free to change it if you like. Add a description if it helps to describe what you did. On the right, select the relevant reviewers based on whoever gave you the task to do.
- Click Create pull request. You're done! We'll review your changes and get back to you (if there's something we'd like you to change) or accept the pull request (if you did great).
Your basic workflow every time you make changes is steps 4 to 14 above. You will execute every single step in sequence.