Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
將此提示複製到我們的開發者 Console 中親自試試看!
| 角色 | 內容 |
|---|---|
| 使用者 | 我對本地檔案做了一些更改,想要將它們儲存到本地 Git 儲存庫中。我應該使用什麼 Git 命令? |
要將您對本地檔案所做的更改儲存到本地 Git 儲存庫中,您應該使用以下 Git 命令:
git add . 或 git add <file>
. 會新增當前目錄及其子目錄中的所有更改。如果您只想暫存特定檔案,請將 . 替換為檔案名稱或路徑。git commit -m "Your commit message"
-m 旗標允許您提供描述所做更改的提交訊息。將 "Your commit message" 替換為對您更改的簡短描述性摘要。例如,如果您對名為 example.txt 的檔案進行了更改,您可以執行:
git add example.txt
git commit -m "Update example.txt with new content"
這些命令會將您的更改儲存到本地 Git 儲存庫中,並使用提供的訊息建立一個新的提交。您之後可以將這些更改推送到遠端儲存庫,或繼續在本地分支上工作。
請記得在終端機或命令提示字元中,從您的 Git 儲存庫目錄內執行這些命令。
Was this page helpful?