Try   HackMD

Git 刪除已 Push 至遠端分支的 Commit 教學與範例

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 →

git reset 13dd72dc43e7368bd2e0238336fade097ea0e0c8

13dd72d是指定的 commit 編號

git push origin main --force # 或是 git push origin feature/瘦身 --force

上面的 main 是分支名稱

把本地的強推到遠端上面🈲🈲🈲自己的分支才能使用,可能會清除別人 Commit 的內容

git log --oneline -n 5

log 前5筆 一行(50字)
沒有 online 會進到編輯狀態,按下 q 才能離開

git log -n 5

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 →

同步本地端 commit

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

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