enter.
curl --remote-name https://raw.githubusercontent.com/18F/laptop/master/mac
and press enter.bash mac 2>&1 | tee ~/laptop.log && source ~/.rvm/scripts/rvm
and press enter. This sets up all of the software you need in order to manage the languages we use at 18F. (For a full list of programs, click here).this
, you’re reading a command. Type the commands exactly as you see them here (or copy and paste them into your Terminal) and always press return at the end.ls
: this will show you everything in the directory where you are currently located. If you type ls -1
it will list them all in a single column for you. ls
stands for “list” and the -1
tells your computer to list the directory in one column. If you are in your home directory, you will probably see a list in Terminal similar to this screenshot:cd Documents
: this will take you into your Documents directory, if that was one of the options shown when you used the ‘ls’ command above. cd
stands for “change directory.”ls -1
again to see all the files inside your Documents directory.ls -1F
: notice a difference? Any item in the list with a /
at the end is another directory.cd .
to go back one directory. Directories stack on top of one another and the directory “above” your current directory is always called .
pwd
: this command shows you the directory you are currently working in. pwd
stands for “print working directory.” You should see something that starts with /Users/
, followed by your computer username. This is called your home directory and you can always get here by typing cd ~
.cd ~
to make sure you’re in your home directorymkdir code
: to create the directory called code
in your home directory. mkdir
stands for Make directory.cd code
should bring your terminal into your code directory.cd ~/code
cd ~/code
and press enter to get to the code
directory we created earlier.git clone
and then paste the URL that you copied to your clipboard. This is now copying the 18f.gsa.gov repo to your local computer.git clone [url]
command.$
.) You only have to do this once. An SSH key is a small file that sits on your computer and tells GitHub who you are. It’s kind of like a password your computer types in for you automatically. Every time you use this computer to clone a project or pull/push a project, this SSH key will get used. You will have to do this on every computer you have. So, if you plan to work on these projects on a separate computer, you will need to do this process again._posts.
All of the pages are in a directory called _pages.
There’s a readme that explains to anyone browsing 18F’s 18f.gsa.gov
GitHub repo how some of this works. At the top of that window, you can see a dropdown that says “branch: staging.”branch:staging
button, you can see a list of all of the “branches” that exist on this project. Every time you come directly to 18f.gsa.gov, it will show you the staging branch because we’ve made that branch the default.cd 18f.gsa.gov
to change directories to 18f.gsa.gov
.ls -1F
to see all of the files and folders in the GitHub repo, just as you saw them on GitHubgit status
staging
by default). If you made any changes and commited them, you’d commit them to the staging
branch.git remote -v
. The name “origin” is arbitrary. You could rename it to “github” if you wanted to, but we won’t do that now../go init
._site
. If you want to just build the site, type ./go build
../go serve
.127.0.0.1:4000
, or http://localhost:4000
for short. You can copy and paste that directly into a browser to double-check. To stop the server, press CTRL + C. If you try to visit http://localhost:4000
after pressing CTRL + C, you won’t see anything.laptop
script once. You only have to clone the repo once. And you only need to run ./go init
once. Just wanted to keep your morale high. Onward!vim
, but we do not recommend TextEdit or a word processor.user/code
where user
is your username.git checkout -b your-branch-name
(The name of the branch can be anything but it should be descriptive.)git checkout
tells git
to work on a different branch. The -b <branch-name>
tells it to create the branch if it does not exist yet. You can switch branches by typing git checkout branch-name
. Try switching back and forth between the branch you just created and staging
to see how this works.git status
to make sure you’re now on the branch. You should see something that looks like this:ls -1F
to see a list of files and folders that make up 18f.gsa.gov’s repo._posts
directory with the name 2015-02-23-new_post.md
where ‘2015-02-23’ is today’s date.git status
again.git status
shows a new section for “untracked files” followed by the name of your blog post. Git has four stages that a file can be in: untracked, modified, staged, and committed. Untracked means git doesn’t know anything about it and will not watch for your changes. Your post is currently untracked and we’re about to move the file through all four stages until it is “committed”.git add _posts/2015-02-23-new-post.md
and hit enter. Make sure to type in your actual filename if it has a different date.git
to remember the changes you made to this file. If you make more changes, the file will be “modified” and you will need to run that command again.git status
again.git commit -m 'My First Post'
followed by entergit status
one more time.nothing to commit, working directory clean
. That’s because nothing has changed since the last commit.git push origin <branch>
(where <branch>
is the name you gave your branch) and then hit enter.Compare and Pull Request
. It’s a big green button.Create Pull Request
.git checkout staging
followed by git pull
again, to make sure your version of the staging branch is current.git pull
one of two things might happen:git pull
you ask GitHub to download the most recent changes. If you get the first message it means nothing has changed since the last time you worked on it. If you get the second, it means someone from the 18F team merged another pull request.