不確定時,先看,不要急著改
git status 回答目前有哪些檔案狀態;git diff 顯示尚未 staged 的差異;git diff --staged 顯示下一個 commit 準備收錄的差異。
git status
git diff
git add app.js
git diff --staged
git commit -m "調整首頁訊息"
git log --oneline
請養成「status → diff → add → diff --staged → commit」的節奏。它像設備上線前的逐項確認:先知道現況,再選擇要納入的變更,最後才建立可追溯版本。
git log --oneline只是較精簡的歷史畫面;commit 之間的父子關係沒有因此改變。
When unsure, inspect before changing
git status tells you the current file states. git diff shows unstaged differences, while git diff --staged shows what is prepared for the next commit.
git status
git diff
git add app.js
git diff --staged
git commit -m "Adjust the home message"
git log --oneline
Build the rhythm “status → diff → add → diff --staged → commit”. It is like a line-start checklist: know the current state, select the changes you want, and only then create a traceable version.
git log --onelineis only a shorter history view; it does not change parent relationships between commits.