[Git 刪除已 Push 至遠端分支的 Commit 教學與範例](https://officeguide.cc/git-delete-commit-in-remote-branch-tutorial-examples/)  ```bash= git reset 13dd72dc43e7368bd2e0238336fade097ea0e0c8 ``` 13dd72d....是指定的 commit 編號 ```bash= git push origin main --force # 或是 git push origin feature/瘦身 --force ``` 上面的 `main` 是分支名稱 把本地的強推到遠端上面🈲🈲🈲自己的分支才能使用,可能會清除別人 Commit 的內容 ```bash= git log --oneline -n 5 ``` log 前5筆 一行(50字) 沒有 --online 會進到編輯狀態,按下 q 才能離開 ```bash= git log -n 5 ```  # 同步本地端 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