場景:需要回退至紅框中的那個版本,並且只添加“緩存邏輯優化,增加加載中的狀態”這一次commit,其他的commit不添加。
步驟:
1) 切換到指定分支 dev
git checkout dev
2) 回退至指定版本
git reset --hard 6fd1e9a70a70f381d060f83d4d4d5dc113ccae35
3) 創建新分支 test
git branch test
git checkout test
4) 添加 “緩存邏輯優化,增加加載中的狀態” 這次commit
git cherry-pick 71f7de8197a629ae3aa536c6cf05c61e6ee8c3e4
5) 把該新建 test 分支 push 到遠端
git push origin test
6) 將本地分支test 與遠程關聯
git branch --set-upstream-to=origin/test
7) 拉取遠程 test 分支
git pull
8) 后續可以在 test 分支上進行bug修復了