參考: [【狀況題】聽說 git push -f 這個指令很可怕,什麼情況可以使用它呢?](https://gitbook.tw/chapters/github/using-force-push) 有人強推會遇到需要做這個動作 # git reset :::success ```shell= git reset --hard 5607e17d80049aff2304ddd40674b6fc0d237c24 ```  複製 Commit ID 取代上面的指令  Tortoise Git 這邊也可以查 Commit ID ::: # 退版流程 參考: [git 退版 reset / command](https://hackmd.io/@minmushroom/S1Yf3KpzY)  ```bash= # 退到指定版本號 git reset --hard af8fb865144724712ebdd65d0d6845037e5cef59 # 退到遠端(注意:可能會蓋掉別人的版本,記得先抓最新,才能推上去) git push --force ``` # 同步本地端 commit 此時本地 commit 紀錄還是之前的狀態,執行下面指令後,就能正常顯示: ```bash= # git pull --force <遠端主機名,一般為origin> <遠端分支名>:<本地分支名> git pull --force origin develop:develop # 或是 git pull --force origin feature/瘦身:feature/瘦身 ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up