Skip to content

Commit 64f1c81

Browse files
committed
Add a TOC
1 parent 7ea80f4 commit 64f1c81

File tree

1 file changed

+52
-17
lines changed

1 file changed

+52
-17
lines changed

content/cheat-sheet/_index.html

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,48 @@
33
subsection: "cheat-sheet"
44
title: "Git Cheat Sheet"
55
url: /cheat-sheet.html
6+
headings:
7+
- text: "Getting Started"
8+
id: "getting-started"
9+
- text: "Prepare to Commit"
10+
id: "prepare-to-commit"
11+
- text: "Make Commits"
12+
id: "make-commits"
13+
- text: "Move Between Branches"
14+
id: "move-between-branches"
15+
- text: "Diff Staged/Unstaged Changes"
16+
id: "diff-staged-unstaged-changes"
17+
- text: "Diff Commits"
18+
id: "diff-commits"
19+
- text: "Ways to refer to a commit"
20+
id: "ways-to-refer-to-a-commit"
21+
- text: "Discard Your Changes"
22+
id: "discard-your-changes"
23+
- text: "Edit History"
24+
id: "edit-history"
25+
- text: "Code Archaeology"
26+
id: "code-archaeology"
27+
- text: "Combine Diverged Branches"
28+
id: "combine-diverged-branches"
29+
- text: "Restore an Old File"
30+
id: "restore-an-old-file"
31+
- text: "Add a Remote"
32+
id: "add-a-remote"
33+
- text: "Push Your Changes"
34+
id: "push-your-changes"
35+
- text: "Pull Changes"
36+
id: "pull-changes"
37+
- text: "Configure Git"
38+
id: "configure-git"
39+
- text: "Important Files"
40+
id: "important-files"
641
---
742

843
<div id="main" class="cheat-sheet">
944
<h1>Git Cheat Sheet</h1>
1045

1146
<section>
12-
<h2>Getting Started</h2>
47+
<h2 id="getting-started">Getting Started</h2>
1348
<div class="item">
1449
<h3>Start a new repo:</h3>
1550
<code>git init</code>
@@ -21,7 +56,7 @@ <h3>Clone an existing repo:</h3>
2156
</section>
2257

2358
<section>
24-
<h2>Prepare to Commit</h2>
59+
<h2 id="prepare-to-commit">Prepare to Commit</h2>
2560
<div class="item">
2661
<h3>Add untracked file or unstaged changes:</h3>
2762
<code>git add &lt;file&gt;</code>
@@ -63,7 +98,7 @@ <h3>Check what you added:</h3>
6398
</section>
6499

65100
<section>
66-
<h2>Make Commits</h2>
101+
<h2 id="make-commits">Make Commits</h2>
67102
<div class="item">
68103
<h3>Make a commit (and open text editor to write message):</h3>
69104
<code>git commit</code>
@@ -79,7 +114,7 @@ <h3>Commit all unstaged changes:</h3>
79114
</section>
80115

81116
<section>
82-
<h2>Move Between Branches</h2>
117+
<h2 id="move-between-branches">Move Between Branches</h2>
83118
<div class="item">
84119
<h3>Switch branches:</h3>
85120
<code>git switch &lt;name&gt;</code>
@@ -111,7 +146,7 @@ <h3>Force delete a branch:</h3>
111146
</section>
112147

113148
<section>
114-
<h2>Diff Staged/Unstaged Changes</h2>
149+
<h2 id="diff-staged-unstaged-changes">Diff Staged/Unstaged Changes</h2>
115150
<div class="item">
116151
<h3>Diff all staged and unstaged changes:</h3>
117152
<code>git diff HEAD</code>
@@ -127,7 +162,7 @@ <h3>Diff just unstaged changes:</h3>
127162
</section>
128163

129164
<section>
130-
<h2>Diff Commits</h2>
165+
<h2 id="diff-commits">Diff Commits</h2>
131166
<div class="item">
132167
<h3>Show diff between a commit and its parent:</h3>
133168
<code>git show &lt;commit&gt;</code>
@@ -147,7 +182,7 @@ <h3>Show a summary of a diff:</h3>
147182
</div>
148183
</section>
149184
<section class="commit-reference">
150-
<h2>Ways to refer to a commit</h2>
185+
<h2 id="ways-to-refer-to-a-commit">Ways to refer to a commit</h2>
151186
<p class="intro">
152187
Every time we say <code>&lt;commit&gt;</code>, you can use any of these:
153188
</p>
@@ -174,7 +209,7 @@ <h2>Ways to refer to a commit</h2>
174209
</section>
175210

176211
<section>
177-
<h2>Discard Your Changes</h2>
212+
<h2 id="discard-your-changes">Discard Your Changes</h2>
178213
<div class="item">
179214
<h3>Delete unstaged changes to one file:</h3>
180215
<code>git checkout &lt;file&gt;</code>
@@ -198,7 +233,7 @@ <h3>'Stash' all staged and unstaged changes:</h3>
198233
</section>
199234

200235
<section>
201-
<h2>Edit History</h2>
236+
<h2 id="edit-history">Edit History</h2>
202237
<div class="item">
203238
<h3>"Undo" the most recent commit (keep your working directory the same):</h3>
204239
<code>git reset HEAD^</code>
@@ -221,7 +256,7 @@ <h3>Change a commit message (or add a file you forgot):</h3>
221256
</section>
222257

223258
<section>
224-
<h2>Code Archaeology</h2>
259+
<h2 id="code-archaeology">Code Archaeology</h2>
225260
<div class="item">
226261
<h3>Look at a branch's history:</h3>
227262
<code>git log main</code>
@@ -247,7 +282,7 @@ <h3>Show who last changed each line of a file:</h3>
247282
</section>
248283

249284
<section>
250-
<h2>Combine Diverged Branches</h2>
285+
<h2 id="combine-diverged-branches">Combine Diverged Branches</h2>
251286
<div class="item">
252287
<h3>Combine with rebase:</h3>
253288
<code>git switch banana</code>
@@ -640,7 +675,7 @@ <h3>Copy one commit onto the current branch:</h3>
640675
</section>
641676

642677
<section>
643-
<h2>Restore an Old File</h2>
678+
<h2 id="restore-an-old-file">Restore an Old File</h2>
644679
<div class="item">
645680
<h3>Get the version of a file from another commit:</h3>
646681
<code>git checkout &lt;commit&gt; &lt;file&gt;</code>
@@ -650,14 +685,14 @@ <h3>Get the version of a file from another commit:</h3>
650685
</section>
651686

652687
<section>
653-
<h2>Add a Remote</h2>
688+
<h2 id="add-a-remote">Add a Remote</h2>
654689
<div class="item">
655690
<code>git remote add &lt;name&gt; &lt;url&gt;</code>
656691
</div>
657692
</section>
658693

659694
<section>
660-
<h2>Push Your Changes</h2>
695+
<h2 id="push-your-changes">Push Your Changes</h2>
661696
<div class="item">
662697
<h3>Push the <code>main</code> branch to the remote <code>origin</code>:</h3>
663698
<code>git push origin main</code>
@@ -681,7 +716,7 @@ <h3>Push tags:</h3>
681716
</section>
682717

683718
<section>
684-
<h2>Pull Changes</h2>
719+
<h2 id="pull-changes">Pull Changes</h2>
685720
<div class="item">
686721
<h3>Fetch changes (but don't change any of your local branches):</h3>
687722
<code>git fetch origin main</code>
@@ -703,7 +738,7 @@ <h3>Fetch all branches:</h3>
703738
</section>
704739

705740
<section>
706-
<h2>Configure Git</h2>
741+
<h2 id="configure-git">Configure Git</h2>
707742
<div class="item">
708743
<h3>Set a config option:</h3>
709744
<code>git config user.name 'Your Name'</code>
@@ -723,7 +758,7 @@ <h3>See all possible config options:</h3>
723758
</section>
724759

725760
<section>
726-
<h2>Important Files</h2>
761+
<h2 id="important-files">Important Files</h2>
727762
<div class="item">
728763
<h3>Local git config:</h3>
729764
<code>.git/config</code>

0 commit comments

Comments
 (0)