Skip to content

Commit 0e28d31

Browse files
committed
Git exercises
1 parent 98683b9 commit 0e28d31

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{
2+
"metadata": {
3+
"name": "",
4+
"signature": "sha256:f6436501b2bf36f6b2e795be6e8c82a98d4f896f247cb628675d100bf81830ea"
5+
},
6+
"nbformat": 3,
7+
"nbformat_minor": 0,
8+
"worksheets": [
9+
{
10+
"cells": [
11+
{
12+
"cell_type": "markdown",
13+
"metadata": {},
14+
"source": [
15+
"Using Git and GitHub\n",
16+
"----"
17+
]
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {},
22+
"source": [
23+
"**Exercise 1**. Create a reepository on GitHub called 'monster-cookies' and clone to your local drive."
24+
]
25+
},
26+
{
27+
"cell_type": "markdown",
28+
"metadata": {},
29+
"source": [
30+
"**Exercise 1.1**. Set your username and email if necessary."
31+
]
32+
},
33+
{
34+
"cell_type": "markdown",
35+
"metadata": {},
36+
"source": [
37+
"**Exercise 2**. Add two files `phd_thesis.txt` and `jasa_manuscript.txt` with the contents `My very short thesis.` and `$\\pi = 3$ almost everywhere.` respectively."
38+
]
39+
},
40+
{
41+
"cell_type": "markdown",
42+
"metadata": {},
43+
"source": [
44+
"**Exercise 3**. Modify `phd_thesis.txt` by adding another line `This is a very good thesis`.\n",
45+
"\n",
46+
"- You decide that you don't want these changes but have not done `git add`. What do you do?\n",
47+
"- You decide that you don't want these changes but have just done `git add`. What do you do?\n",
48+
"- You decide that you don't want these changes but have just done `git commit`. What do you do?\n",
49+
"- You decide that you don't want these changes but have just done `git push`. What do you do?"
50+
]
51+
},
52+
{
53+
"cell_type": "markdown",
54+
"metadata": {},
55+
"source": [
56+
"**Exercise 4**: Modify \"jasa_mnauscript.txt\" by replacing the number 3 with 22/7. Add, commit and push your changes."
57+
]
58+
},
59+
{
60+
"cell_type": "markdown",
61+
"metadata": {},
62+
"source": [
63+
"**Exercise 5**. You accidnetally type `rm phd_thesis.txt` and realize you haven't backed up your laptop in 3 years. What do you do?"
64+
]
65+
},
66+
{
67+
"cell_type": "markdown",
68+
"metadata": {},
69+
"source": [
70+
"**Exercise 6**. You accidentally deleted the `monster-cookies` folder on your hard drive with `rm -rf monster-cookies`. What do you do?"
71+
]
72+
},
73+
{
74+
"cell_type": "markdown",
75+
"metadata": {},
76+
"source": [
77+
"**Exercise 7**. Your laptop falls into the lake at Sarah P Duke gardens and is eaten by a turtle. What do you do?"
78+
]
79+
},
80+
{
81+
"cell_type": "markdown",
82+
"metadata": {},
83+
"source": [
84+
"**Exericse 8**. You realize that $\\pi = 3$ after all, and want to go back to the version before you made the 22/7 switch. What do you do?"
85+
]
86+
},
87+
{
88+
"cell_type": "markdown",
89+
"metadata": {},
90+
"source": [
91+
"**Exercise 9**. You want to show off your productivity to your thesis advisor. What do you do?"
92+
]
93+
},
94+
{
95+
"cell_type": "markdown",
96+
"metadata": {},
97+
"source": [
98+
"**Exercise 10**. You the follwoing Python scritpt to `monster-cookies` and run it. \n",
99+
"```python\n",
100+
"for i in range(10):\n",
101+
" open('f%02d.dat' % i, 'w').write('This contains intermediate results #%d' % i)\n",
102+
"```\n",
103+
"\n",
104+
"Now you have a `.py` file that you want to commit to GitHub and lots of `.dat` files that you don't want to commit but still wish to keep in the folder. What do you do?"
105+
]
106+
},
107+
{
108+
"cell_type": "code",
109+
"collapsed": false,
110+
"input": [],
111+
"language": "python",
112+
"metadata": {},
113+
"outputs": []
114+
}
115+
],
116+
"metadata": {}
117+
}
118+
]
119+
}

0 commit comments

Comments
 (0)