在 git commit 後,發現打錯字,修正最後一次 commit。
git commit --amend
在 git commit 後,想回到某個特定的版本,
預設為 soft 只會抹掉 commit,修改的內容及檔案還是保留,
hard 則是全部回覆。
git reset
git reset --hard
上面的情境,git reset 後又反悔,該怎麼辦?
git rebase -i
進入 vim
1 pick 175a270 Prepare for 2.42
2 pick afd9e00 Prepare for 2.42(20150618).
3 pick 110d487 Fixed Bug-893.
改成
1 pick 110d487 Fixed Bug-893.
2 pick 175a270 Prepare for 2.42
3 fixup afd9e00 Prepare for 2.42(20150618).
fixup: 合併 175a270 與 110d480 且不保留 175a270 commit message.
squash: 同上,唯一不同是保留 commit message.