git 指令如何撤销一次merge
在使用git指令时难免会发生错误的merge的情况,那么如何在这种情况下回退到错误发生之前的情况?
git reflog 指令显示历史的操作
4457e43 HEAD@{0}: reset: moving to 4457e43
5361fad HEAD@{1}: reset: moving to HEAD~
6aab9da HEAD@{2}: pull upstream master: Merge made by the 'octopus' strategy.
4457e43 HEAD@{3}: checkout: moving from scale_test to master
d0fefb0 HEAD@{4}: rebase -i (finish): returning to refs/heads/scale_test
d0fefb0 HEAD@{5}: rebase -i (squash): add test file for pkg/kubectl/scale_test.go
2ccaaf2 HEAD@{6}: rebase -i (start): checkout a64eeb47f6ed4aa2587113793a76878b876809f9
d5c9696 HEAD@{7}: commit: modified: pkg/kubectl/cmd/scale_test.go
2ccaaf2 HEAD@{8}: checkout: moving from kubectl_cp_error to scale_test
936781b HEAD@{9}: rebase -i (finish): returning to refs/heads/kubectl_cp_error
再用git reset --hard 4457e43就可以回退到操作之前的状态了