Try   HackMD

參考: 【狀況題】聽說 git push -f 這個指令很可怕,什麼情況可以使用它呢?
有人強推會遇到需要做這個動作

git reset

git reset --hard 5607e17d80049aff2304ddd40674b6fc0d237c24

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

複製 Commit ID 取代上面的指令

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Tortoise Git 這邊也可以查 Commit ID

退版流程

參考: git 退版 reset / command

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

# 退到指定版本號 git reset --hard af8fb865144724712ebdd65d0d6845037e5cef59 # 退到遠端(注意:可能會蓋掉別人的版本,記得先抓最新,才能推上去) git push --force

同步本地端 commit

此時本地 commit 紀錄還是之前的狀態,執行下面指令後,就能正常顯示:

# git pull --force <遠端主機名,一般為origin> <遠端分支名>:<本地分支名> git pull --force origin develop:develop # 或是 git pull --force origin feature/瘦身:feature/瘦身