-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
137 lines (115 loc) · 7.17 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,400italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Ubuntu+Condensed' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="UTF-8">
<title>Cheatsheet Git</title>
<link rel="icon" type="image/ico" href="favicon.ico" />
</head>
<body>
<!--HEADER-->
<header>
<img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png">
<p id="title">CheatSheet Git<p>
</header>
<!--Summary-->
<ul>
<h3 id="summary">SUMMARY</h3>
<li><a href="#table1">Configure tooling</a></li>
<li><a href="#table2">Create repositories</a></li>
<li><a href="#table3">Make changes</a></li>
<li><a href="#table4">Group changes</a></li>
<li><a href="#table5">Refactor filenames</a></li>
<li><a href="#table6">Suppress tracking</a></li>
<li><a href="#table7">Review history</a></li>
<li><a href="#table8">Redo commits</a></li>
<li><a href="#table9">Save fragments</a></li>
<li><a href="#table10">Synchronise changes</a></li>
</ul>
<!--Commands and descriptions-->
<div class="cheatsheet">
<table id="table1" border width="80%">
<caption>CONFIGURE TOOLING</caption>
<tr><th width="40%">Command</th><th width="60%">Description</th></tr>
<tr><td class="command">$ git config --global user.name "[name]"</td><td>Sets the name you want attached to your commit transactions</td></tr>
<tr><td class="command">$ git config --global user.email "[email address]"</td><td>Sets the email you want attached to your commit transactions</td></tr>
<tr><td class="command">$ git config --global color.ui auto</td><td>Enables helpful colorization of command line output</td></tr>
</table>
<table id="table2" border width="80%">
<caption>CREATE REPOSITORIES</caption>
<tr><th width="40%">Command</th><th width="60%">Description</th></tr>
<tr><td class="command">$ git init [project-name]</td><td>Creates a new local repository with the specified name</td></tr>
<tr><td class="command">$ git clone [url]</td><td>Downloads a project and its entire version history</td></tr>
</table>
<table id="table3" border width="80%">
<caption>MAKE CHANGES</caption>
<tr><th width="40%">Command</th><th width="60%">Description</th></tr>
<tr><td class="command">$ git diff</td><td>Shows file differences not yet staged</td></tr>
<tr><td class="command">$ git add [file]</td><td>Snapshots the file in preparation for versioning</td></tr>
<tr><td class="command">$ git diff --staged</td><td>Shows file differences between staging and the last file version</td></tr>
<tr><td class="command">$ git reset [file]</td><td>Unstages the file, but preserve its contents</td></tr>
<tr><td class="command">$ git commit -m "[descriptive message]"</td><td>Records file snapshots permanently in version history</td></tr>
</table>
<table id="table4" border width="80%">
<caption>GROUP CHANGES</caption>
<tr><th width="40%">Command</th><th width="60%">Description</th></tr>
<tr><td class="command">$ git branch</td><td>Lists all local branches in the current repository</td></tr>
<tr><td class="command">$ git branch [branch-name]</td><td>Creates a new branch</td></tr>
<tr><td class="command">$ git checkout [branch-name]</td><td>Switches to the specified branch and updates the working directory</td></tr>
<tr><td class="command">$ git merge [branch]</td><td>Combines the specified branch’s history into the current branch</td></tr>
<tr><td class="command">$ git branch -d [branch-name]</td><td>Deletes the specified branch</td></tr>
</table>
<table id="table5" border width="80%">
<caption>REFACTOR FILENAMES</caption>
<tr><th width="40%">Command</th><th width="60%">Description</th></tr>
<tr><td class="command">$ git rm [file]</td><td>Deletes the file from the working directory and stages the deletion</td></tr>
<tr><td class="command">$ git rm --cached [file]</td><td>Removes the file from version control but preserves the file locally</td></tr>
<tr><td class="command">$ git mv [file-original] [file-renamed]</td><td>Changes the file name and prepares it for commit</td></tr>
</table>
<table id="table6" border width="80%">
<caption>SUPPRESS TRACKING</caption>
<tr><th width="40%">Command</th><th width="60%">Description</th></tr>
<tr><td class="command">$ git ls-files --other --ignored --exclude-standard</td><td>Lists all ignored files in this project</td></tr>
</table>
<table id="table7" border width="80%">
<caption>REVIEW HISTORY</caption>
<tr><th width="40%">Command</th><th width="60%">Description</th></tr>
<tr><td class="command">$ git log</td><td>Lists version history for the current branch</td></tr>
<tr><td class="command">$ git log --follow [file]</td><td>Lists version history for a file, including renames</td></tr>
<tr><td class="command">$ git diff [first-branch]...[second-branch]</td><td>Shows content differences between two branches</td></tr>
<tr><td class="command">$ git show [commit]</td><td>Outputs metadata and content changes of the specified commit</td></tr>
</table>
<table id="table8" border width="80%">
<caption>REDO COMMITS</caption>
<tr><th width="40%">Command</th><th width="60%">Description</th></tr>
<tr><td class="command">$ git reset [commit]</td><td>Undoes all commits after [commit], preserving changes locally</td></tr>
<tr><td class="command">$ git reset --hard [commit]</td><td>Discards all history and changes back to the specified commit</td></tr>
</table>
<table id="table9" border width="80%">
<caption>SAVE FRAGMENTS</caption>
<tr><th width="40%">Command</th><th width="60%">Description</th></tr>
<tr><td class="command">$ git stash</td><td>Temporarily stores all modified tracked files</td></tr>
<tr><td class="command">$ git stash pop</td><td>Restores the most recently stashed files</td></tr>
<tr><td class="command">$ git stash list</td><td>Lists all stashed changesets</td></tr>
<tr><td class="command">$ git stash drop</td><td>Discards the most recently stashed changeset</td></tr>
</table>
<table id="table10" border width="80%">
<caption>SYNCHRONISE CHANGES</caption>
<tr><th width="40%">Command</th><th width="60%">Description</th></tr>
<tr><td class="command">$ git fetch [bookmark]</td><td>Downloads all history from the repository bookmark</td></tr>
<tr><td class="command">$ git merge [bookmark]/[branch]</td><td>Combines bookmark’s branch into current local branch</td></tr>
<tr><td class="command">$ git push [alias] [branch]</td><td>Uploads all local branch commits to GitHub</td></tr>
<tr><td class="command">$ git pull</td><td>Downloads bookmark history and incorporates changes</td></tr>
</table>
</div>
<!--FOOTER-->
<footer>
<p id="source">Source: <a href="https://help.github.com/">GitHub Help</a></p>
</footer>
<!--------------BUTTON------------------>
<a id="upper" href="#summary">Go back</br> to top</a>
</body>
</html>