一, 編寫一個名為
readme.txt
檔案,放入
pythonwork
目錄下
① 手動建立
② 使用指令: touch readme.txt
vim readme.txt
PS:
使用
vim
指令打開檔案時,預設為指令模式;
按
i
或
insert
鍵 可進入插入模式,進行編輯;
按
ESC
退回指令模式,按
ZZ
或
:wq
儲存并退出;
按
:w
儲存不退出,留在指令模式;
按
:q!
放棄所有修改并退出;
按
:e!
放棄修改但不退出,留在指令模式。
二, 添加 和 送出
Step 1 :
git add readme.txt
Step 2 :
git commit -m “readme.txt”
git status
檢視倉庫目前狀态
三 修改readme.txt檔案
在readme.txt檔案末尾添加 “This is my first time to write a turorial.”,儲存并退出。
git diff readme.txt
可檢視檔案修改内容
知道了做了什麼修改後,再送出更新就放心了。
執行:
git add readme.txt
git commit -m “first time”
表示 檔案修改内容還未添加到倉庫
表示 檔案已添加到倉庫,但未送出
表示 檔案已經可以被Git 所跟蹤管理了。