-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathguide.html
216 lines (215 loc) · 10.1 KB
/
guide.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Git Basics || Git & Github</title>
<link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="assets/style.css" rel="stylesheet" />
</head>
<body class="vh-100">
<div class="container-fluid h-100">
<div class="row minh-100">
<div class="bg-black minh-md-100 col-md-5 col-xxl-3 position-fixed z-2">
<div
class="row w-md-100 mh-md-100vh align-items-center justify-content-start text-start"
>
<div class="col">
<div class="row">
<div class="container">
<nav
class="navbar navbar-expand-md bg-black flex-row flex-md-column align-items-center align-items-md-start"
data-bs-theme="dark"
>
<a class="navbar-brand w-md-100" href="index.html"
><h1 class="fw-lighter fs-4 display-md-4 w-100 text-wrap">
Introduction to Git and Github
</h1></a
>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div
class="collapse navbar-collapse flex-column align-items-start"
id="navbarNav"
>
<span class="text-white mb-3 fw-lighter"
>By
<a
class="text-secondary"
href="https://github.com/alepbloyd"
target="_blank"
rel="noopener noreferrer"
>Alex Boyd</a
>
and
<a
class="text-secondary"
href="https://github.com/maxturer"
target="_blank"
rel="noopener noreferrer"
>Max Turer</a
></span
>
<ul
class="navbar-nav nav-underline flex-md-column text-uppercase"
>
<li class="nav-item">
<a
class="nav-link"
aria-current="page"
href="index.html"
>Home</a
>
</li>
<li class="nav-item">
<a class="nav-link" href="what-is-git.html"
>What is Git?</a
>
</li>
<li class="nav-item">
<a class="nav-link" href="setting-up-git.html"
>Setting up Git</a
>
</li>
<li class="nav-item">
<a class="nav-link active" href="guide.html"
>Git basics</a
>
</li>
<li class="nav-item">
<a class="nav-link" href="push-guide.html"
>Pushing to GitHub</a
>
</li>
<li class="nav-item">
<a class="nav-link" href="links.html"
>Links for further reading</a
>
</li>
</ul>
</div>
</nav>
</div>
</div>
</div>
</div>
</div>
<div class="col col-right">
<div
class="row h-md-100 align-items-center justify-content-center text-center"
>
<div class="col p-3 fw-light text-start">
<div class="border border-black h-75vh mh-75vh fade-in">
<div class="border-bottom border-black flex-pls align-items-center flex-row">
<div class="circles p-2 h-fit-content flex-pls align-items-center">
<span class="dot red-bg m-1"></span><span class="dot yellow-bg m-1"></span><span class="dot green-bg m-1"></span>
</div>
<div class="flex-grow-1 text-center m-n60">
<div class="text">
Terminal — bash — Git Basics
</div>
</div>
</div>
<div class="container h-box overflow-y-auto minw-100">
<h2 class="fw-lighter p-2">> Making a basic Git Repository</h2>
<div class="row mw-100 flex-pls flex-column">
<div class="col">
<p>
In your terminal, navigate to the directory you want to
track. <br />
For now, create an empty directory (or “folder”) with the
<span class="code p-1">mkdir</span> command: <br />
<span class="code p-1">mkdir my-new-git-repo</span>
</p>
<p>
Once you’ve made your directory, move into it via command
line with the <span class="code p-1">cd</span> command:
<br />
<span class="code p-1">cd my-new-git-repo</span>
</p>
<p>
If you want to make sure it worked, you can enter
<span class="code p-1">pwd</span>. It should return the
path to your new directory (
<span class="code p-1"
>/Users/[yourname]/my-new-git-repo</span
>
).
</p>
<p>
Initialize git in your directory by entering: <br />
<span class="code p-1">git init</span>
</p>
<p>
You should see something like “Initialized empty Git
repository in /Users/[yourname]/my-new-git-repo/.git/”
</p>
<p>
Make a new file to track with git. Use
<span class="code p-1">cat</span> to create a text file
called <b>hello.txt</b>: cat > hello.txt
</p>
<p>
The terminal should bring you to an empty line. Type in
<b>Hello, world!</b> (or whatever you'd like to save in a
text file) and then press
<span class="code p-1">Ctrl + D</span> to save. <br />
If you enter
<span class="code p-1">cat hello.txt</span> (no
<b>></b> this time), your terminal will show you the
contents of your text file. You should see the text you
just typed.
</p>
</div>
<div class="col">
<p>
Let's check on git now. You can do this by entering:<br>
<span class="code p-1">git status</span>
</p>
<p>
You should see a message that includes this: <br>
<div class="p-1 ms-5">Untracked files:<br> (use “git add” <file>...” to include in what will be committed)<br> <span class="red">hello.txt</span></div>
</p>
<p>
Let’s do exactly that. Add your new file to be tracked by Git: <br>
<span class="code p-1">git add hello.txt</span>
</p>
<p>
If you enter <span class="code">git status</span> now, you’ll get a similar message, but <span class="green">hello.txt</span> will be in <span class="green">green</span> and under the heading “Changes to be committed:”
</p>
<p>
A <b>commit</b> is a message Git will store that describes the changes you’re making and asking Git to track. It can be as detailed or basic as you want.
</p>
<p>
To commit your changes, use <span class="code p-1">>git commit</span>, add a <span class="code p-1">-m</span>, then enclose your message in quotes: <br>
<span class="code p-1">git commit -m "created hello.txt, a text file containing Hello, World!"</span>
</p>
<p>
It’s also common for your first commit in a new repository to be “first commit,” like so: <br>
<span class="code p-1">git commit -m "first commit"</span>
</p>
<p>
<h3 class="fw-lighter">> Continue to <a href="push-guide.html">Pushing to GitHub</a></h3>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>