-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathindex.html
More file actions
111 lines (88 loc) · 5.56 KB
/
index.html
File metadata and controls
111 lines (88 loc) · 5.56 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=1.0">
<title>Basic Git Tutorial</title>
<link rel="stylesheet" href="../../styles/reset.css">
<link rel="stylesheet" href="http://www.thecodeeducators.com/css/normalize.css">
<link rel="stylesheet" href="../../styles/base.css">
<style>
body {
font-size: 1rem;
line-height: 1.4;
}
main {
max-width: 960px;
margin: 0 auto;
padding: 0 30px;
}
h1 {
text-align: center;
}
h1, h2 {
margin: 24px 0 0;
}
dt:not(:first-of-type) {
margin: 12px 0 0;
}
kbd, code {
font-size: 1rem;
}
dt > code {
background-color: transparent;
}
dd {
margin-top: 12px;
margin-bottom: 28px;
}
</style>
</head>
<body>
<h1>Basic Git Tutorial</h1>
<main>
<h2 id="commands">Commands</h2>
<dl>
<dt><kbd>git status</kbd></dt>
<dd>Displays the status of the repository, indicating whether a file has been changed or deleted, for example. Or, whether a new file has been added that Git is not aware of.</dd>
<dt><kbd>git clone git@REMOTE_HOST:USER/REPO.git</kbd></dt>
<dd>Clones <code>REPO</code> belonging to <code>USER</code> from <code>REMOTE_HOST</code>. For example, <kbd>git clone [email protected]:code-warrior/dockspacer.git</kbd> clones the <code>dockspacer</code> repository belonging to user <code>code-warrior</code> from the <code>github.com</code> remote host, which happens to be a web site, to your local computer.</dd>
<dt><kbd>git checkout -b hotfix</kbd></dt>
<dd>Creates a new branch named <code>hotfix</code> and switches to it.</dd>
<dt><kbd>git diff</kbd></dt>
<dd>Displays the changes made to one or more files that has not been added to the staging area, also known as the index.</dd>
<dt><kbd>git diff --cached</kbd></dt>
<dd>Displays the changes made to one or more files that has been added to the staging area/index, but has/have not been committed.</dd>
<dt><kbd>git add .</kbd></dt>
<dd>Adds the current directory (<code>.</code>) to the staging area/index.</dd>
<dt><kbd>git commit -m 'YOUR MESSAGE HERE'</kbd></dt>
<dd>Commits the changes in the staging area/index to the repository with the message (<code>-m</code>) <code>YOUR MESSAGE HERE</code>. The message must be wrapped in inch marks (<code>""</code>) or foot marks (<code>''</code>), and the convention is to keep the message under 60 characters.</dd>
<dt><kbd>git pull</kbd></dt>
<dd>Fetches the changes from the remote repository, then merges them into the local repository.</dd>
<dt><kbd>git push</kbd></dt>
<dd>Pushes and merges your local changes to a remote repository.</dd>
</dl>
<h2 id="command-prompt">Command Prompt</h2>
<p>Authored by <a href="http://blog.spearce.org/" target="_blank" rel="noopener">Shawn Pearce</a>, the Git-based prompt I use provides some useful information about the current state of the Git repository without having to issue a command. An explanation of some of its icon characters follows. You can read more about the project on <a href="https://github.com/git/git/tree/master/contrib/completion" target="_blank" rel="noopener">GitHub</a>.</p>
<dl>
<dt><code>(master)</code></dt>
<dd>You’re on the <code>master</code> branch, which is local and does not exchange files with a remote branch.</dd>
<dt><code>(dev <>)</code> or <code>(dev=)</code></dt>
<dd>You’re on the <code>dev</code> branch, which exchanges files with a remote branch.</dd>
<dt><code>(master %<>)</code> or <code>(master %=)</code></dt>
<dd>You’re on the <code>master</code> branch that exchanges files with a remote branch (<code><></code> or <code>=</code>) and contains a file or a folder with new files that is not being tracked (<code>%</code>).</dd>
<dt><code>(dev *<>)</code> or <code>(dev *=)</code></dt>
<dd>You’re on the <code>dev</code> branch that exchanges files with a remote branch (<code><></code> or <code>=</code>) and contains one or more files that have been modified (<code>*</code>) in the working directory but have not been committed to the staging area, or index.</dd>
<dt><code>(master +<>)</code> or <code>(master +=)</code></dt>
<dd>You’re on the <code>master</code> branch that exchanges files with a remote branch (<code><></code> or <code>=</code>) and contains one or more files that have been placed in the staging area/index (<code>+</code>) and are ready to be committed. This is the result of having issued the <kbd>git add .</kbd> command or the like.</dd>
<dt><code>(dev>)</code></dt>
<dd>You’re on the <code>dev</code> branch that contains changes not pushed to the remote branch (<code>></code>).</dd>
<dt><code>(master $)</code></dt>
<dd>You’re on the <code>master</code> branch that contains stashed changes. This is the result of having carried out the <kbd>git stash</kbd> command.</dd>
</dl>
<h2>Messages</h2>
<p>The following means you’re issuing Git commands within a folder/directory that is <strong>not</strong> under Git control.</p>
<pre><code>fatal: Not a git repository (or any of the parent directories): .git</code></pre>
</main>
</body>
</html>