[TOC]
# 步驟:建立一個新檔案
現在你有了一個程序庫 repository 了,新增一個檔案到里頭吧!
打開一個文字編輯器。現在開始寫幾行文字,說聲嗨之類的,并將檔案儲存為`readme.txt`到你在上個挑戰中所建立的'hello-world'資料夾。
# 步驟:現況 status、新增 add 及 提交 commit 修改
接著檢查你的 程式庫 repository 的 現況 status,看看是否在里頭有任何修改。回到你的終端機,應該還在你剛剛所建立的'hello-world' 資料夾里頭,直接用這個指令查看狀態:
~~~
$ git status
~~~
接著將剛剛建立文件,add 進你想 提交 commit(或儲存)的修改。
~~~
$ git add readme.txt
~~~
最后,將那些修改 提交 commit 到 repository 的歷史記錄當中,并隨附上一個簡短的改動說明。
~~~
$ git commit -m "<your commit message>"
~~~
> **`git add`**命令主要用于把我們要提交的文件的信息添加到索引庫中。當我們使用`git commit`時,git將依據索引庫中的內容來進行文件的提交。
# 步驟:進行更多修改
現在在多寫一行文字到`readme.txt`之中并存檔。
在命令行里你可以查看有那些 差異 **diff** 存在于現在的檔案以及上次你所 提交 commit 的檔案之間。
~~~
$ git diff
~~~
利用你剛剛所學到的知識,提交 commit 這個最新的修改。
# Tips
檢查 repository 中的修改 現況 status
```
$ git status
```
查看對檔案的修改
```
$ git diff
```
準備 提交 commit 對于一個檔案的修改
```
$ git add <FILENAME>
// or
$ git add .
```
提交 commit(或儲存)您所準備好的修改并附上一個簡短的改動說明
```
$ git commit -m "<your commit message>"
```
> Xee:需要注意??,根據所參與的項目規定的規范,進行規范的 commit 提交!否則你的 PR 不會被通過!
- 介紹
- 1. Get Git - 安裝并且設置Git
- 2. Repository - 建立一個本地的repository
- 3. Commit to it - 檢查狀態、新增或修改commits
- 4. GitHubbin - 注冊GitHub帳號
- 5. Remote Control - 將repository做本地和遠程的連接
- 6. Forks and Clones - Fork和clone一個開源的計劃
- 7. Branches aren't just for Birds - 建立一個feature branch
- Git分支開發模型
- 8. It's a Small World - 邀請并和別人合作
- 9. Pull, Never Out of Date - 利用Push和pull來和GitHub.com同步
- 10. Requesting You Pull Please - 建立一個pull request
- 11. Merge Tada - Merge和刪除branches
- 學會 GitHub
- GitHub 使用指南
- git 與 github 模板配置
- GitHub Actions
- 實用技巧
- Git Flow
- Submodule子模塊
- 工作記錄
- 常用命令
- 幫助
- 資源
- 解疑答惑