aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/learn/tools_and_testing/github/index.html
blob: 8899a3fd1b218b5c785ae6cb8e119358b919ed4e (plain)
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
---
title: Git and GitHub
slug: Learn/Tools_and_testing/GitHub
tags:
  - Beginner
  - GitHub
  - Learn
  - Web
  - git
---
<div>{{LearnSidebar}}</div>

<p class="summary">所有開發者都將使用到一些<strong>版本控制系統</strong> (<strong> V</strong>ersion <strong>C</strong>ontrol <strong>S</ strong>ystem, 簡稱<strong> VCS</strong> ), 這種工具讓人們可以與其他開發者同公開發一個專案同時避免了不必要的重複與衝突,如果遇到什麼問題,也可以及時回退到之前的版本。當今最流行的<strong>版本控制系統</strong>(至少在網絡開發者中是這樣的)是<strong> Git</strong>,和與之關聯的程式社區網站<strong> GitHub</strong > 。這篇短文將帶你簡單地了解他們。 </p>

<h2 id="Overview">概述</h2>

<p>版本控制系統在軟體開發過程中是不可或缺的:</p>

<ul>
 <li>It is rare that you will work on a project completely on your own, and as soon as you start working with other people you start to run the risk of conflicting with each other's work — this is when both of you try to update the same piece of code at the same time. You need to have some kind of mechanism in place to manage the occurrences, and help avoid loss of work as a result.</li>
 <li>When working on a project on your own or with others, you'll want to be able to back up the code in a central place, so it is not lost if your computer breaks.</li>
 <li>You will also want to be able to roll back to earlier versions if a problem is later discovered. You might have started doing this in your own work by creating different versions of the same file, e.g. <code>myCode.js</code>, <code>myCode_v2.js</code>, <code>myCode_v3.js</code>, <code>myCode_final.js</code>, <code>myCode_really_really_final.js</code>, etc., but this is really error-prone and unreliable.</li>
 <li>Different team members will commonly want to create their own separate versions of the code (called <strong>branches</strong> in Git), work on a new feature in that version, and then get it merged in a controlled manner (in GitHub we use <strong>pull requests</strong>) with the master version when they are done with it.</li>
</ul>

<p>VCSes provide tools to meet the above needs. <a href="https://git-scm.com/">Git</a> is an example of a VCS, and <a href="https://github.com/">GitHub</a> is a web site + infrastructure that provides a Git server plus a number of really useful tools for working with git repositories individually or in teams, such as reporting issues with the code, reviewing tools, project management features such as assigning tasks and task statuses, and more.</p>

<div class="notecard note">
<p><strong>Note</strong>: Git is actually a <em>distributed</em> version control system, meaning that a complete copy of the repository containing the codebase is made on your computer (and everyone else's). You make changes to your own copy and then push those changes back up to the server, where an administrator will decide whether to merge your changes with the master copy.</p>
</div>

<div class="callout">
  <h4 id="Looking_to_become_a_front-end_web_developer">Looking to become a front-end web
    developer?</h4>

  <p>We have put together a course that includes all the essential information you need to
    work towards your goal.</p>

  <p><a href="/en-US/docs/Learn/Front-end_web_developer"><strong>Get started</strong></a></p>

</div>

<h2 id="Prerequisites">Prerequisites</h2>

<p>To use Git and GitHub, you need:</p>

<ul>
 <li>A desktop computer with Git installed on it (see the <a href="https://git-scm.com/downloads">Git downloads page</a>).</li>
 <li>A tool to use Git. Depending on how you like to work, you could use a <a href="https://git-scm.com/downloads/guis/">Git GUI client</a> (we'd recommend GitHub Desktop, SourceTree or Git Kraken) or just stick to using a terminal window. In fact, it is probably useful for you to get to know at least the basics of git terminal commands, even if you intend to use a GUI.</li>
 <li>A <a href="https://github.com/join">GitHub account</a>. If you haven't already got one, sign up now using the provided link.</li>
</ul>

<p>In terms of prerequisite knowledge, you don't need to know anything about web development, Git/GitHub, or VCSes to start this module. However, it is recommended that you know some coding so that you have reasonable computer literacy, and some code to store in your repositories!</p>

<p>It is also preferable that you have some basic terminal knowledge, so for example moving between directories, creating files, and modifying the system <code>PATH</code>.</p>

<div class="notecard note">
<p><strong>Note</strong>: Github is not the only site/toolset you can use with Git. There are other alternatives such as <a href="https://about.gitlab.com/">GitLab</a> that you could try, and you could also try setting your own Git server up and using it instead of GitHub. We've only stuck with GitHub in this course to provide a single way that works.</p>
</div>

<h2 id="Guides">Guides</h2>

<p>Note that the links below take you to resources on external sites. Eventually, we are aiming to have our own dedicated Git/GitHub course, but for now, these will help you get to grips with the subject at hand.</p>

<dl>
 <dt><a href="https://guides.github.com/activities/hello-world/">Hello, World (from GitHub)</a></dt>
 <dd>This is a good place to start — this practical guide gets you to jump right into using GitHub, learning the basics of Git such as creating repositories and branches, making commits, and opening and merging pull requests.</dd>
 <dt><a href="https://guides.github.com/introduction/git-handbook/">Git Handbook (from GitHub)</a></dt>
 <dd>This Git Handbook goes into a little more depth, explaining what a VCS is, what a repository is, how the basic GitHub model works, Git commands and examples, and more.</dd>
 <dt><a href="https://guides.github.com/activities/forking/">Forking Projects (from GitHub)</a></dt>
 <dd>Forking projects is essential when you want to contribute to someone else's code. This guide explains how.</dd>
 <dt><a href="https://help.github.com/en/articles/about-pull-requests">About Pull Requests (from GitHub)</a></dt>
 <dd>A useful guide to managing pull requests, the way that your suggested code changes are delivered to people's repositories for consideration.</dd>
 <dt><a href="https://guides.github.com/features/issues/">Mastering issues (from GitHub)</a></dt>
 <dd>Issues are like a forum for your GitHub project, where people can ask questions and report problems, and you can manage updates (for example assigning people to fix issues, clarifying the issue, letting people know things are fixed). This articles gives you what you need to know about issues.</dd>
</dl>

<div class="notecard note">
<p><strong>Note</strong>: There is <strong>a lot more</strong> that you can do with Git and GitHub, but we feel that the above represents the minimum you need to know to start using Git effectively. As you get deeper into Git, you'll start to realize that it is easy to go wrong when you start using more complicated commands. Don't worry, even professional web developers find Git confusing sometimes, and often solve problems by searching for solutions on the web, or consulting sites like <a href="https://github.com/k88hudson/git-flight-rules">Flight rules for Git</a> and<a href="https://dangitgit.com/"> Dangit, git!</a></p>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="https://guides.github.com/introduction/flow/">Understanding the GitHub flow</a></li>
 <li><a href="https://git-scm.com/docs">Git command list</a></li>
 <li><a href="https://guides.github.com/features/mastering-markdown/">Mastering markdown</a> (the text format you write in on PR, issue comments, and <code>.md</code> files).</li>
 <li><a href="https://guides.github.com/features/pages/">Getting Started with GitHub Pages</a> (how to publish demos and websites on GitHub).</li>
 <li><a href="https://learngitbranching.js.org/">Learn Git branching</a></li>
 <li><a href="https://github.com/k88hudson/git-flight-rules">Flight rules for Git</a> (a very useful compendium of ways to achieve specific things in Git, including how to correct things when you went wrong).</li>
 <li>
  <p><a href="https://dangitgit.com/">Dangit, git!</a> (another useful compendium, specifically of ways to correct things when you went wrong).</p>
 </li>
</ul>