提交檔案
我們將新增一個新檔案,並將其註冊在我們剛建立的儲存庫中。
使用下列文本內容在該目錄中建立一個名為sample.txt
的檔案。
Anyone can learn Git with this tutorial and Backlog
在 Sourcetree 的書籤窗口中雙擊tutorial
儲存庫,來彈出儲存庫操作視窗。如果目錄中有任何剛才新增或編輯的檔案,將顯示在工作目錄檔案檢查工具的左下角。
因為我們剛才將sample.txt
檔案新增到tutorial
目錄中,所以我們看到它列在那裡。
![Repository screen](/static/8c11f0b95f88f0313905583abeafb21f/5a190/01.png)
右鍵單擊「sample.txt」檔案,並選取「Add to Index」。該檔案將移動到上面的「Files staged in the index」清單中。
![Click Add to Index](/static/500f0fab423196661a6b1cc61b036d24/5a190/02.png)
單擊工具列上的「Commit」圖示,輸入提交訊息 (例如,「first commit」),然後單擊「Commit」。
![Enter commit message and click commit button](/static/223524d4efccd988c4c5ab76b5be0e4f/5a190/03.png)
完成後,您將在「main」分支歷史紀錄中找到提交。您可以透過單擊左側選單中的「History」來驗證提交是否成功。
![The commit is added](/static/4aac2c06925e1ab22d9812557fc13491/5a190/04.png)
接下來,您已準備好與您的團隊共享儲存庫。