git stash
git stash 將修改的部分丟進暫存
git stash list 列出暫存的資料
git stash pop 取出暫存
git stash drop 刪除暫存
git stash clear 刪除所有暫存
git commit
新增到 Local repository
git commit path1/file1 path2/ m "Message"
git commit --amend ( 修改變最後一次 commit log)
git checkout
切換/建立/還原 file
git checkout branch_B (切換 至 branch_B)
git checkout -b New_branch (從本地當下, 建立 new_branch, 並切換至 New_branch)
git checkout path/file (還原一個修改的檔案)
git checkout path1/file1 path2/file2.. (還原多個修改過的檔案)
git checkout HEAD (所有檔案回復到 local 最後 commit 的版本)
git checkout commitID (所有檔案回復到 commitID 版本)
git branch
git branch (列出 local 端的所有 branch)
git branch -r (列出 remote 端的所有 branch)
git branch -d branch_name ( 刪除 local branch)
git reset
還原至某版本的 commit 狀態
git reset --soft HEAD^ (取消前一次 commit 紀錄 , 但保留修改檔案)
git reset --hard HEAD^ (取消前一次 commit 紀錄 , 修改的檔案會消失)
git reset --soft commitID (回復記錄到 commitID 版本 , 但保留修改的檔案)
git reset --hard commitID (回復記錄到 commitID 版本 , 所有檔案也回復到該版本)
git reset --hard origin/branch_name ( 回復 branch 內所有修改內容)
git tag
建立標記, 適合用 於 Released FW 版本記錄
git tag -l (列出所有 tags)
git checkout <tag_name>
git tag -a v1.4 m "alpha1" (建立 tag , a: tag 名稱 ; m: tag 說明)
git push origin --tags (把 Local repository 建立好的所有 tags,上傳到 Remote repository ))
git ls
git ls-files --stage
100644 aee89ef43dc3b0ec6a7c6228f742377692b50484 0 .gitignore
100755 0ac339497485f7cc80d988561807906b2fd56172 0 my_executable_script.sh
產生最新 4 筆 patch 檔
git format-patch -4
找某一年修改
git blame index.page.js | grep "2021"