變化比較
- git diff
比較當前未add文件與上一次add文件的區(qū)別(workingtree與index)
git diff [--options] [--] [<path>…?] //eg. git diff master -- Folder/ develop -- Folder/
git diff [filename] //eg. git diff MyFlder/
比較未commit文件的與上次commit文件的區(qū)別(index與HEAD)
git diff --cached [filename]
比較未add文件與上次commit文件的區(qū)別(workingtree與HEAD)
git diff HEAD [filename]
- git add -p
會顯示當前未add文件與working tree文件的區(qū)別秩仆,并可選擇add的方式
Stage this hunk [y,n,q,a,d,/,s,e,?]? n
y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk or any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk or any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help
另附一個將不同命令執(zhí)行后workingtree, index 和 HEAD之間變化的關系圖。workflow