git 退版 reset / command
先理解git的每個狀態

local本地退版,並保留做錯的文檔
從 7a525f0 回到 8cfae32,但是想在工作區保留這段時間(7a525f0)更改的文檔.
- 在 8cfae32 reset current branch to this commit -> hard.
- 再到之前的head 7a525f0 reset current branch to this commit -> soft.
- stage 區域就會有 7a525f0 的修改.
- 最後結果不會砍掉 7a525f0 而是以 cae30e2 覆蓋.

遠端退版,並以舊的版本push到遠端
從 9cc62eb 退到 5e4ee6e. 並以 5e4ee6e push to remote.

- 計算要退5個commit. 如果要退的commit數很多,可以少退幾個確認head在哪再繼續退.

git reset --hard HEAD~4
退四版確認head位置
git reset --hard HEAD~
git push --force
退版後的版本push到遠方
git command
reference:
https://gitbook.tw/chapters/github/delete-remote-branch.html
https://dotblogs.com.tw/michaelfang/2016/09/07/git-reset-log-reflog
https://gitbook.tw/chapters/using-git/reset-commit