Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 51 additions & 27 deletions docs/translations/README.zh-tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

閱讀文章和觀看教學會有所幫助。不過,有什麼方法能比在不會弄亂任何東西的情況下,實際動手做來得更好?本項目旨在指導初學者及簡化初學者參與開源的方式。記住:過程越輕鬆,學習效益越高。如果妳/你想要做出第一次貢獻,只需按照以下簡單步驟操作即可。跟你保證,這會很好玩 :)

#### _如果你不喜歡使用指令列,[這裡有使用圖形界面工具的教學。](#使用其他工具的教學)_
_如果你不喜歡使用指令列,[這裡有使用圖形界面工具的教學。](#使用其他工具的教學)_

<img align="right" width="300" src="https://firstcontributions.github.io/assets/Readme/fork.png" alt="fork this repository" />

如果你的電腦上尚未安裝 git,請按照這個[安裝指南(英文)](https://help.github.com/articles/set-up-git/)進行安裝。
#### 如果你的電腦上尚未安裝 git,請按照這個[安裝指南(英文)](https://help.github.com/articles/set-up-git/)進行安裝。

## 分叉(Fork)本儲存庫

Expand All @@ -23,7 +23,7 @@

<img align="right" width="300" src="https://firstcontributions.github.io/assets/Readme/clone.png" alt="clone this repository" />

接下來,將複製後的儲存庫複製到你/妳的電腦上。點選圖示中的綠色按鈕,接著點選複製到剪貼簿按鈕(將儲存庫網址複製下來)
接下來,將分叉後的儲存庫複製到你/妳的電腦上。前往你/妳的GitHub帳號,打開分叉到帳號下的儲存庫,點選圖示中的綠色按鈕,接著在SSH分頁上點選*複製到剪貼簿*按鈕(將儲存庫網址複製下來)

隨後打開命令列視窗,輸入如下 git 命令:

Expand All @@ -38,23 +38,23 @@ git clone "url you just copied"
譬如:

```bash
git clone https://github.com/<this-is-you>/first-contributions.git
git clone git@github.com:this-is-you/first-contributions.git
```

'this-is-you' 指的就是你/妳的 GitHub 用戶名。這一步會將你/妳的 first-contributions 儲存庫複製到你的電腦上。
`this-is-you` 指的就是你/妳的 GitHub 用戶名。這一步會將你/妳的 first-contributions 儲存庫複製到你的電腦上。

## 新建一個分支(Branch)

下面的命令能在命令行窗口中,把目錄切換到 first-contributions
下面的命令能在命令行窗口中,把目錄切換到 first-contributions(如果你/妳尚未切換到該目錄):

```bash
cd first-contributions
```

接下來使用 `git switch` 命令建立一個程式碼分支
接下來使用 `git switch` 命令建立一個分支

```bash
git switch -c <add-your-name>
git switch -c your-new-branch-name
```

譬如:
Expand All @@ -65,48 +65,77 @@ git switch -c add-david

(新分支的名稱不一定需要有 _add_。然而,在這個新分支的名稱加入 _add_ 是一件合理的事情,因為這個分支的目的是將妳/你的名字添加到貢獻者列表中。)

<details>
<summary> <strong>如果在使用 git switch 命令的過程中出現錯誤(error),點擊這裡:</strong> </summary>

如果顯示錯誤訊息 "Git: `switch` is not a git command. See `git –help`",這可能是因為你/妳使用的是舊版的 git。

在這種情況下,請改為使用 `git checkout` 命令:

```bash
git checkout -b your-new-branch-name
```

</details>

## 對程式碼進行修改,然後提交 (Commit) 修改

使用妳/你喜歡的編輯器打開 `Contributors.md` 這個文件,將自己的名字加在檔案最下面,然後存檔。在命令窗口執行 `git status`,這會列出被更動的文件。接著 `git add` 這命令則可以添加更動項目到分支裡,就像以下這條命令
使用妳/你喜歡的編輯器打開 `Contributors.md` 這個文件,將自己的名字加在檔案中,不要將其添加到文件的開頭或結尾。將其新增至文件中間的任意位置,然後存檔

<img align="right" width="450" src="https://firstcontributions.github.io/assets/Readme/git-status.png" alt="git status" />

在命令窗口執行 `git status`,這會列出被更動的文件。

接著 `git add` 這命令則可以添加更動項目到分支裡,就像以下這條命令:

```bash
git add Contributors.md
```

現在就可以使用 `git commit` 命令 commit(提交)你/妳的修改了
現在就可以使用 `git commit` 命令 commit(提交)你/妳的修改了

```bash
git commit -m "Add <your-name> to Contributors list"
git commit -m "Add your-name to Contributors list"
```

將 `<your-name>` 替換為自己的名字
將 `your-name` 替換為自己的名字

## 將更動發佈(Push)到 GitHub

使用 `git push` 命令發佈代碼
使用 `git push` 命令發佈代碼

```bash
git push origin <add-your-name>
git push -u origin your-branch-name
```

將 `<add-your-name>` 替換為之前新建的分支名稱。
將 `your-branch-name` 替換為之前新建的分支名稱。

<details>
<summary> <strong>如果在發佈(push)過程中出錯誤(error),點擊這裡</strong> </summary>
<summary> <strong>如果在發佈(push)過程中出現錯誤(error),點擊這裡</strong> </summary>

- ### 身份驗證錯誤(Authentication Error)
<pre>remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/<your-username>/first-contributions.git/'</pre>
fatal: Authentication failed for 'https://github.com/&lt;your-username>/first-contributions.git/'</pre>
去 [GitHub's tutorial](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) 學習如何生成新的 SSH 密匙以及配置。

此外,你/妳可能需要執行 'git remote -v' 來檢查遠端儲存庫的URL。

如果看起來與這樣有一點相似:

<pre>origin https://github.com/your-username/your_repo.git (fetch)
origin https://github.com/your-username/your_repo.git (push)</pre>

使用以下命令更改它:
```bash
git remote set-url origin git@github.com:your-username/your_repo.git
```
否則,你/妳仍會收到要求輸入使用者名稱和密碼的提示,並出現身份驗證錯誤。
</details>

## 提出 Pull Request 將你/妳的修改供他人審閱

前往先前自己 Fork 的 GitHub 儲存庫,會看到一個 `Compare & pull request` 的按鈕,點選該按鈕。
前往你/妳的GitHub帳號,打開分叉到帳號下的儲存庫,會看到一個 `Compare & pull request` 的按鈕,點選該按鈕。

<img style="float: right;" src="https://firstcontributions.github.io/assets/Readme/compare-and-pull.png" alt="create a pull request" />

Expand All @@ -119,18 +148,13 @@ git push origin <add-your-name>

## 下一步?

在[這個網站](https://firstcontributions.github.io/#social-share)慶祝妳/你的成就並跟朋友及追隨者分享。

如果你想要更多練習,請看 [code contributions](https://github.com/roshanjossey/code-contributions)。

恭喜!妳/你剛剛完成了作為一個貢獻者會經常使用的標準工作流程:_fork -> clone -> edit -> pull request_!

恭喜!妳/你剛剛完成了作為一個貢獻者會經常使用的標準工作流程:fork -> clone -> edit -> pull request!
在[這個網站](https://firstcontributions.github.io/#social-share)慶祝妳/你的貢獻並跟朋友及追隨者分享。

現在讓我們一起為其他專案做出貢獻吧!

我們整理了一份有簡單議題的專案清單來幫助你開始貢獻。
[去看看吧!](https://firstcontributions.github.io/#project-list)
如果你想要更多練習,請看 [code contributions](https://github.com/roshanjossey/code-contributions)。

現在就動手為其他專案貢獻你/妳的心力。我們整理了一個清單,裡面的專案都有簡單的議題可以著手。[去看看吧!](https://firstcontributions.github.io/#project-list)

### [ 更多資料 ](../additional-material/git_workflow_scenarios/additional-material.md)

Expand Down