-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab_013.html
80 lines (74 loc) · 3.09 KB
/
lab_013.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
<!doctype html>
<html lang="en">
<head>
<title>
Lab 13 - Staging and Committing
</title>
<meta charset="UTF-8" />
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
<meta "="" content=" width=device-width, initial-scale=1.0" name="viewport" />
<meta content="A guided tour through the fundamentals of Git, HTML, & CSS" name=" description" />
<meta content="#0000ff" name="theme-color" />
<link href="manifest.json" rel="manifest" />
<link href="css/reset.css" media="screen" rel="stylesheet" />
<link href="css/screen.css" media="screen" rel="stylesheet" />
<link href="css/prism.css" rel="stylesheet" />
</head>
<body data-lab-id="13">
<a class="skip-to-content" href="#content" tabindex="1">
Skip to content
</a>
<main class="layout">
<nav id="index">
<p class="link-home">
<a href="index.html">
<span>Hack4Impact Starter Pack</span>
</a>
</p>
<button class="link-menu">
Menu
</button>
<nav tabindex="0">
<ol>
</ol>
</nav>
</nav>
<div id="content" tabindex="-1">
<h1 class="lab_title">
<em>Lab 13</em>
Staging and Committing
</h1>
<h2>Goals</h2>
<ul>
<li>Learn about the benefits of separate staging and committing</li>
</ul>
<h2>Small and Frequent</h2>
<p>The separate staging and committing states in <code>Git</code> allows for you to fine-tune your source control.
You can make changes to your working directory, staging the changes until you are ready to deal with
source control. When you are ready to commit, you can make small and frequent commits that group changes in
a logical way.</p>
<p>For example, suppose you are working on three files: <code>file-a</code>, <code>file-b</code>, and
<code>file-c</code>. You have made your changes and staged the files with <code>git add</code> and are ready to
commit them. However, the changes you made in <code>file-c</code> don't relate logically to the changes you made
in <code>file-a</code> and <code>file-b</code>.
</p>
<p>You could do the following:</p>
<h3><b>Execute</b></h3>
<pre class="command-line" data-prompt="$" data-filter-output="(out)"><code class="language-git">git add file-a
git add file-b
git commit -m "feat: change file-a and file-b"</code></pre>
<h3><b>Execute</b></h3>
<pre class="command-line" data-prompt="$" data-filter-output="(out)"><code class="language-git">git add file-c
git commit -m "feat: change file-c"</code></pre>
<p class="note"><strong>Note:</strong> Too many commits is better than too few, but a good rule of thumb for when to commit is whenever
the feature or task you are working on changes.</p>
</div>
</main>
<script src="js/ui.js" type="text/javascript"></script>
<script src="js/prism.js" type="text/javascript"></script>
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
mermaid.initialize({startOnLoad: true, theme: "base"});
</script>
</body>
</html>