git
常用 git 指令
git rebase
1 | git rebase dog |
Reference: 另一種合併方式(使用 rebase)
cherry pick
首先,你的「工作目錄」必須是乾淨,工作目錄下的「索引」不能有任何準備要 commit 的檔案 (staged files) 在裡面,否則將會無法執行。
其建立的版本訊息,將會與你指定挑選的那些版本一模一樣,其中包括 Author 與 Date
欄位,都會一模一樣,並不會用你在選項設定中指定的 user.name 與 user.email 參數
一次撿多個 commit
1 | git cherry-pick fd23e1c 6a498ec f4f4442 |
或是 -x 讓 commit 附加上訊息
1 | cherry picked from commit dc070173c8d087b4e65084653e31b81910f3f2e5 |
僅套用更變不建立 commit,先暫放在暫存區,來留下自己的 Author & Date information
1 | -n |
編輯 commit message
1 | -e |
reset
修改 commit 順序/commit 訊息
1 | // 會開啟從 HEAD 到 HEAD~~ 的提交 |
如果切換分支沒有清理乾淨,可利用下列指令
1 | git reset —hard |