Skip to content

Commit 1549ad4

Browse files
committed
Add gitgit to session 2
1 parent 3d64d74 commit 1549ad4

File tree

6 files changed

+106
-27
lines changed

6 files changed

+106
-27
lines changed

_sessions/c1s2/1_recap.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,26 @@ browser.
1111

1212
### Command line
1313

14-
* `ls`
15-
* `cd coding_course`
16-
* `cd ..`
14+
* `ls` - list the files in the current directory
15+
* `cd coding_course` - move into the 'coding_course' directory
16+
* `cd ..` - move up a level
1717

1818
{% exercise %}
19-
1. Open the command line ('Terminal' on a mac, 'Command prompt with Ruby
20-
on Rails' on windows)
21-
2. Use `cd` and `ls` to navigate to your `coding_course` folder.
19+
<ol>
20+
<li>Open the command line ('Terminal' on a mac, 'Command prompt with Ruby on Rails' on windows)</li>
21+
<li>Use cd and ls to navigate to your coding_course folder.</li>
22+
</ol>
2223
{% endexercise %}
2324

2425
### Something new
2526

2627
{% exercise %}
27-
1. Make sure you're in your `coding_course` folder.
28-
2. Do an `ls`.
29-
3. Type `git clone https://github.com/code61/html2.git`
30-
4. Do an `ls`.
28+
<ol>
29+
<li>Make sure you're in your coding_course folder.</li>
30+
<li>Do an ls.</li>
31+
<li>Type git clone https://github.com/code61/html2.git</li>
32+
<li>Do an ls.</li>
33+
</ol>
3134
{% endexercise %}
3235

3336
You just used git to get the code for the next exercise onto your

_sessions/c1s2/3_css.md renamed to _sessions/c1s2/2_css.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ h3 {
4747
Note that you can specify multiple properties on one element. When you do this it's nice to lay them out on multiple lines as done above.
4848

4949
{% exercise %}
50-
1. Use git to clone the repo for this part of the session: [https://github.com/code61/html2](https://github.com/code61/html2).
5150
2. Open `exercise1.html` in Sublime Text and in Chrome.
5251
3. Add some css in the `head` to make the `h1` turn red.
5352
5. Continue with the exercise until `exercise1.html` looks like `exercise1_solution.png`.
54-
{% endexercise %}
53+
{% endexercise %}
File renamed without changes.

_sessions/c1s2/5_push_to_github.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: "Pushing to GitHub"
3+
---
4+
5+
Git is a version control system. It allows you to keep the entire history of your code, and makes it easy to share and collaborate with others.
6+
7+
### Using git
8+
9+
Using git is really easy:
10+
11+
1. Set up a folder to be a _git repo_. This tells git to track all changes in that folder.
12+
2. After you've made some changes, save them into the repository.
13+
3. Once you've saved the changes push them up to github.
14+
15+
The first point is important: *git works on a folder level*. It tracks all the changes you make to files within a given folder.
16+
17+
### Actually using git
18+
19+
Actually using git is a bit harder. It's a very powerful tool and pretty complex to get started with. To make things simpler, we're going to use a tool called `gitgit`.
20+
21+
To install gitgit open the command line and type the following:
22+
23+
gem install gitgit
24+
25+
To see if this worked, type
26+
27+
gitgit
28+
29+
You should see a list of gitgit commands something like this:
30+
31+
$ gitgit
32+
Commands:
33+
gitgit help [COMMAND] # Describe available commands or one specific command
34+
gitgit init # Initialise a git repo
35+
gitgit lg # Show your recent saves
36+
gitgit push # Push your changes to github
37+
gitgit save # Save you changes to the repo
38+
gitgit status # See what changes you've made since you last save
39+
40+
If it didn't work, you might need to do
41+
42+
sudo gem install gitgit
43+
44+
and type your password.
45+
46+
You also might need to do
47+
48+
rbenv rehash
49+
50+
If in doubt contact a teaching assistant!
51+
52+
### Using gitgit
53+
54+
To **make a folder into a git repository**:
55+
56+
gitgit init
57+
58+
then follow the instructions. You'll only need to do this once for each folder you want to make into a repository.
59+
60+
After you've made some changes to your files and saved them, you can **save them into your repo** by typing:
61+
62+
gitgit save
63+
64+
Finally, to push your code up to github you can do
65+
66+
gitgit push
67+
68+
Before you do this, you will need to setup your repo with github.
69+
70+
### Setting up your repo with github
71+
72+
Go to github, login, and click "Create New Repo" in the top left hand corner.
73+
74+
![Creating a repo on GitHub](/assets/create_repo.png)
75+
76+
Follow the instructions, calling it something like `first_site`. **Do not** click the box which says 'Create a readme with this repository'. You'll get to a page when it'll describe how to get your code online. You want to follow the instructions for "Pushing an existing repository to github".
77+
78+
### Pushing your code to github
79+
80+
We will now set up your `first_site` folder to use git and push it up to github.
81+
82+
{% exercise %}
83+
<ol>
84+
<li>Navigate to your first_site folder using cd and ls.</li>
85+
<li>Make it into a git repo: "gitgit init"</li>
86+
<li>Save all the work you've done so far: "gitgit save"</li>
87+
<li>Log in to GitHub.</li>
88+
<li>On github create a new repository called 'first_site'. DO NOT click the box which says 'Create a readme'.</li>
89+
<li>Copy and paste the instructions it gives you into the command line. You are 'Pushing an existing repository to github'.</li>
90+
<li>Go back to github and refresh the page. You should see your code.</li>
91+
</ol>
92+
{% endexercise %}

_sessions/c1s2/_5_push_to_github.md

-15
This file was deleted.

0 commit comments

Comments
 (0)