1. 查看提交歷史(最近10個)
git log -10
2. 回到前面第十個commit,且將后面九個commit提交的內容狀態改為未提交
git reset commitID(第十個commit的ID)
3. 提交修改的內容
git add .
git commit -m "dev: 將前九個commit合並為一個"
4. 提交到遠程分支
$ git push origin change_skin To git@192.168.0.116:rubik-x/rubik-project.git ! [rejected] change_skin -> change_skin (non-fast-forward) error: failed to push some refs to 'git@192.168.0.116:rubik-x/rubik-project.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
5. 執行報錯,由於本地沒有遠程的前九個commit節點,且想將自己的新的commit節點提交,如下所示:

6. 如果該分支上的代碼僅你一個人在更新,可以強制執行本地代碼覆蓋遠程代碼操作(遠程的前9個commit將刪除,本地的合並后的commit將推到遠程):
git push -f origin change_skin
