forked from essc/noah-wb-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git.html
293 lines (268 loc) · 14.3 KB
/
git.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Using Git and GitHub — NOAH-WB-FOSS4G Workshop 0.1 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="top" title="NOAH-WB-FOSS4G Workshop 0.1 documentation" href="index.html" />
<link rel="next" title="Using TileMill and MapBox" href="tilemill.html" />
<link rel="prev" title="NOAH-WB-FOSS4G Workshop Materials" href="index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="tilemill.html" title="Using TileMill and MapBox"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="NOAH-WB-FOSS4G Workshop Materials"
accesskey="P">previous</a> |</li>
<li><a href="index.html">NOAH-WB-FOSS4G Workshop 0.1 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="using-git-and-github">
<h1>Using Git and GitHub<a class="headerlink" href="#using-git-and-github" title="Permalink to this headline">¶</a></h1>
<p>Git is a distributed revision control and source code management (SCM) system
with an emphasis on speed. Initially designed and developed by Linus Torvalds
for Linux kernel development, Git has since been adopted by many other projects.</p>
<p>Every Git working directory is a full-fledged repository with complete history
and full revision tracking capabilities, not dependent on network access or a
central server.</p>
<p>Git is free software distributed under the terms of the GNU General
Public License version 2.</p>
<div class="section" id="setting-up-your-github-account-and-git">
<h2>Setting up your GitHub account and Git<a class="headerlink" href="#setting-up-your-github-account-and-git" title="Permalink to this headline">¶</a></h2>
<p>1. Create a GitHub account, go to:
<a class="reference external" href="https://github.com/users">https://github.com/users</a></p>
<p>2. Set up Git in your
machine. Open the <cite>Terminal</cite>.</p>
<p>Add your username</p>
<div class="highlight-python"><pre>$ git config --global user.name "Your Name Here"
# Sets the default name for git to use when you commit</pre>
</div>
<p>Add your email</p>
<div class="highlight-python"><pre>git config --global user.email "your_email@example.com"
# Sets the default email for git to use when you commit</pre>
</div>
<p>Your email address for Git should be the same one associated with your
GitHub account.</p>
<p>3. Password caching. Tell git that you don’t want to type your username and
password every time you talk to a remote server.</p>
<div class="highlight-python"><pre>$ git config --global credential.helper cache
# Set git to use the credential memory cache
$ git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)</pre>
</div>
</div>
<div class="section" id="forking-a-repo">
<h2>Forking a repo<a class="headerlink" href="#forking-a-repo" title="Permalink to this headline">¶</a></h2>
<p>We will start editing some files to the <tt class="docutils literal"><span class="pre">noah-wb-workshop</span></tt> repository.</p>
<p>1. To fork the repo, go to:
<a class="reference external" href="https://github.com/essc/noah-wb-workshop">https://github.com/essc/noah-wb-workshop</a></p>
<p>2. Click the <cite>Fork</cite>
button.</p>
<img alt="_images/fork_noahwb_repo.png" class="align-center" src="_images/fork_noahwb_repo.png" style="width: 500pt;" />
<p>The repo is now forked in your own GitHub account, but, you need to clone
the project in your local machine to work on the project.</p>
<p>3. Cloning your fork.
In the <cite>Terminal</cite>,</p>
<div class="highlight-python"><pre>$ git clone https://github.com/username/noah-wb-workshop.git
# Clones your fork of the repository into the current directory in terminal</pre>
</div>
<p>4. Configuring remotes. We will add a new remote in order to keep track and
get updates from the original <tt class="docutils literal"><span class="pre">essc</span></tt> repository. We will label this as
<tt class="docutils literal"><span class="pre">upstream</span></tt>.</p>
<div class="highlight-python"><pre>$ cd noah-wb-workshop
# Changes the active directory in the prompt to the newly cloned directory
$ git remote add upstream https://github.com/essc/noah-wb-workshop.git
# Assigns the original repository to a remote called "upstream"
$ git fetch upstream
# Pulls in changes not present in your local repository, without modifying your files</pre>
</div>
</div>
<div class="section" id="editing-files-in-your-forked-project">
<h2>Editing files in your forked project.<a class="headerlink" href="#editing-files-in-your-forked-project" title="Permalink to this headline">¶</a></h2>
<p>1. In your <cite>file manager</cite>, open the <tt class="docutils literal"><span class="pre">noah-wb-workshop</span></tt> directory. Go to the
<tt class="docutils literal"><span class="pre">webmap</span></tt> directory. Open the <tt class="docutils literal"><span class="pre">map1.html</span></tt> in a <cite>text editor</cite>. This is a
page template
for a webmap we will create.</p>
<pre class="literal-block">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Leaflet Map1</title>
<link rel="stylesheet" href="leaflet.css" />
<script type="text/javascript" src="js/leaflet.js"></script>
<link rel="stylesheet" type="text/css" href="leaflet-openweathermap.css" />
<script type="text/javascript" src="js/leaflet-openweathermap.js"></script>
</head>
<body>
<!-- define a DIV into which the map will appear. Make it take up the whole window -->
<div style="width:100%; height:100%" id="map"></div>
</body>
</html>
</pre>
<p>2. Let’s add the OpenStreetMap default tiles. Inside the <tt class="docutils literal"><span class="pre">body</span></tt> tag, add the
following:</p>
<div class="highlight-python"><pre><script type='text/javascript'>
var map = new L.Map('map', {center: new L.LatLng(14.6146, 121.0081), zoom: 10});
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
map.addLayer(osm);
</script></pre>
</div>
<p>3. Save your html file and open in your
<cite>webbrowser</cite>.</p>
<img alt="_images/map1.png" class="align-center" src="_images/map1.png" style="width: 400pt;" />
<p>4. Let’s add the <tt class="docutils literal"><span class="pre">Precipitation</span></tt> layer from <a class="reference external" href="http://www.openweathermap.org/">http://www.openweathermap.org/</a> .
Below the <tt class="docutils literal"><span class="pre">map.addLayer(osm);</span></tt>, add the following:</p>
<div class="highlight-python"><pre>var precipitation = L.OWM.precipitation({showLegend: false, opacity: 0.5});
map.addLayer(precipitation);</pre>
</div>
<p>The full html code should look like this:</p>
<pre class="literal-block">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Leaflet Map1</title>
<link rel="stylesheet" href="leaflet.css" />
<script type="text/javascript" src="js/leaflet.js"></script>
<link rel="stylesheet" type="text/css" href="leaflet-openweathermap.css" />
<script type="text/javascript" src="js/leaflet-openweathermap.js"></script>
</head>
<body>
<!-- define a DIV into which the map will appear. Make it take up the whole window -->
<div style="width:100%; height:100%" id="map"></div>
<script type='text/javascript'>
<!-- Set map center to Metro Manila at zoom level 10 using OSM Default tile -->
var map = new L.Map('map', {center: new L.LatLng(14.6146, 121.0081), zoom: 10});
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
map.addLayer(osm);
<!-- Add precipitation layer from OpenWeatherMap, and set the opacity to 50% -->
var precipitation = L.OWM.precipitation({showLegend: false, opacity: 0.5});
map.addLayer(precipitation);
</script>
</body>
</html>
</pre>
<p>And your map like this:</p>
<img alt="_images/map1_precip.png" class="align-center" src="_images/map1_precip.png" style="width: 500pt;" />
</div>
<div class="section" id="commit-your-changes-in-git-and-github">
<h2>Commit your changes in Git and GitHub<a class="headerlink" href="#commit-your-changes-in-git-and-github" title="Permalink to this headline">¶</a></h2>
<p>1. Let’s commit your changes in your local repository.
In the <cite>Terminal</cite>:</p>
<div class="highlight-python"><pre>$ git commit -am 'first commit'
# Commits your files, adding the message "first commit"</pre>
</div>
<p>2. Your commits are now in your local repository.
To push your commits to GitHub:</p>
<div class="highlight-python"><pre>$ git push
# Sends your commits in the "gh-pages" branch to GitHub</pre>
</div>
<p>3. Go to your Github project page to see the
changes.</p>
</div>
<div class="section" id="references">
<h2>References<a class="headerlink" href="#references" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://help.github.com/categories/54/articles">https://help.github.com/categories/54/articles</a></li>
<li><a class="reference external" href="http://git-scm.com/">http://git-scm.com/</a></li>
<li><a class="reference external" href="http://gitimmersion.com/">http://gitimmersion.com/</a></li>
<li><a class="reference external" href="http://www.openweathermap.org/">http://www.openweathermap.org/</a></li>
<li><a class="reference external" href="http://wiki.openstreetmap.org/wiki/User:Zartbitter/OpenWeatherMap">http://wiki.openstreetmap.org/wiki/User:Zartbitter/OpenWeatherMap</a></li>
<li><a class="reference external" href="http://en.wikipedia.org/wiki/Git_%28software%29">http://en.wikipedia.org/wiki/Git_%28software%29</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/essclogotrace_thumbnail.jpg" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Using Git and GitHub</a><ul>
<li><a class="reference internal" href="#setting-up-your-github-account-and-git">Setting up your GitHub account and Git</a></li>
<li><a class="reference internal" href="#forking-a-repo">Forking a repo</a></li>
<li><a class="reference internal" href="#editing-files-in-your-forked-project">Editing files in your forked project.</a></li>
<li><a class="reference internal" href="#commit-your-changes-in-git-and-github">Commit your changes in Git and GitHub</a></li>
<li><a class="reference internal" href="#references">References</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">NOAH-WB-FOSS4G Workshop Materials</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="tilemill.html"
title="next chapter">Using TileMill and MapBox</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/git.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="tilemill.html" title="Using TileMill and MapBox"
>next</a> |</li>
<li class="right" >
<a href="index.html" title="NOAH-WB-FOSS4G Workshop Materials"
>previous</a> |</li>
<li><a href="index.html">NOAH-WB-FOSS4G Workshop 0.1 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2013, http://www.essc.org.ph license under GNU Free Document License.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
</div>
</body>
</html>