forked from jlord/git-it
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commit_to_it.html
128 lines (104 loc) · 8.17 KB
/
commit_to_it.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
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Git-it Guide</title>
<meta name="description" content="learn git and github">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="../assets/imgs/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="../assets/css/style.css">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700,900' rel='stylesheet' type='text/css'>
</head>
<body>
<!--[if lt IE 8]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<header class="site-header">
<div class="nav">
<!-- <span class="left hand">☜</span> -->
<span class="filledblock"><a href="../index-zhtw.html">Git-it</a></span>
<!-- <span class="right hand">☞</span> -->
</div>
<div class="wrapper">
<div class="challenge-band left">
<span class="meta">CHALLENGE</span>
<h2>commit to it</h2>
</div>
<div class="number-band right tar">
<span class="meta">NUMBER</span>
<h2>3 / 11</h2>
<div>
</div>
</header>
<div class="wrapper">
<div class="challenge">
<h2>關卡內容:</h2>
<p>在你的 <n><span class="superscript">程式庫</span>repository</n> 中建立一個新檔案,新增一些內容到那個檔案並且將那些修改 <v><span class="superscript">提交</span>commit</v> 到 Git 中。
</p></div>
<h2>步驟:建立一個新檔案</h2>
<p>現在你有了一個 <n><span class="superscript">程式庫</span>repository</n> 了,新增一個檔案到裡頭吧!</p>
<p>打開一個文字編輯器。現在開始寫幾行文字,說聲嗨之類的,並將檔案儲存為 <code>readme.txt</code> 到你在上個挑戰中所建立的 'hello-world' 資料夾。</p>
<h2>步驟:<n><span class="superscript">現況</span>status</n>、<v><span class="superscript">新增</span>add</v> 及 <v><span class="superscript">提交</span>commit</v> 修改</h2>
<p>接著檢查你的 <n><span class="superscript">程式庫</span>repository</n> 的 <strong><n><span class="superscript">現況</span>status</n></strong>,看看是否在裡頭有任何修改。回到你的終端機,應該還在你剛剛所建立的 'hello-world' 資料夾裡頭,直接用這個指令查看狀態:</p>
<p><code>$ git status</code></p>
<p>接著將剛剛建立檔案,<v><span class="superscript">新增</span>add</v> 進你想 <strong><v><span class="superscript">提交</span>commit</v></strong>(或儲存)的修改。
</p><p><code>$ git add readme.txt</code></p>
<p>最後,將那些修改 <v><span class="superscript">提交</span><strong>commit</strong></v> 到 <n><span class="superscript">程式庫</span>repository</n> 的歷史紀錄當中,並隨附上一個簡短的異動說明。</p>
<p><code>$ git commit -m "<your commit message>"</code></p>
<h2>步驟:進行更多修改</h2>
<p>現在在多寫一行文字到 <code>readme.txt</code> 之中並存檔。</p>
<p>在終端機裡你可以查看有那些 <strong><n><span class="superscript">差異</span>diff</n></strong> 存在於現在的檔案以及上次你所 <v><span class="superscript">提交</span>commit</v> 的檔案之間。</p>
<p><code>$ git diff</code></p>
<p>利用你剛剛所學到的知識,<v><span class="superscript">提交</span>commit</v> 這個最新的修改。</p>
<div class="verify">
<h3>確認你完成了所有步驟:</h3><code>git-it verify</code>
<h3>前往下一關:</h3><code>git-it</code>
</div>
<div id="git-tips">
<h2>撇步</h2>
<ul>
<li><strong>檢查 <n><span class="superscript">程式庫</span>repository</n> 中的修改 <n><span class="superscript">現況</span>status</n></strong></li>
<li><code>$ git status</code></li>
<li><strong>查看對檔案的修改</strong></li>
<li><code>$ git diff</code></li>
<li><strong>準備 <v><span class="superscript">提交</span>commit</v> 對於一個檔案的修改</strong></li>
<li><code>$ git add <FILENAME></code></li>
<li><strong>準備 <v><span class="superscript">提交</span>commit</v> 對於所有檔案的修改</strong></li>
<li><code>$ git add .</code></li>
<li><strong><v><span class="superscript">提交</span>commit</v>(或儲存)您所準備好的修改並附上一個簡短的異動說明</strong></li>
<li><code>$ git commit -m "<your commit message>"</code></li>
<ul>
</ul></ul></div>
<div class="prenext">
<div class="pre lef meta">
<a href="repository.html">repository</a>
<div>⤶ </div>
</div>
<div class="next tar right meta">
<a href="githubbin.html">GitHubbin</a>
<div>⤷</div>
</div>
</div>
<footer>
<ul>
<li class="meta"><a href="../index-zhtw.html"><strong>Git-it Challenges</strong></a></li>
<li class="meta"><a href="../about.html">About</a></li>
<li class="meta"><a href="../dictionary.html">Dictionary</a></li>
<li class="meta"><a href="../resources.html">Resources</a></li>
<li class="meta">
<a href="http://github.com/jlord/git-it/issues/new" target="_blank">Open an Issue</a>
</li>
</ul>
</footer>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-52690821-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>