逃避腐败 git rebase 你可以做到以下几点
git rebase
rebase
git reflog
例如, reflog 会给你以下的。 rebase起点是最后一个 rebase (start) 要么 rebase -i (start) 如果你做了一个互动的rebase。这里是 HEAD@{1} :
reflog
rebase (start)
rebase -i (start)
HEAD@{1}
$ git reflog f10ccfed (HEAD) HEAD@{0}: rebase : fast-forward 383aa038 (origin/master, origin/HEAD) HEAD@{1}: rebase (start): checkout HEAD~10 0600cf7e (origin/Files, master, Files) HEAD@{4}: checkout: moving from master to Files 0600cf7e (origin/Files, master, Files) HEAD@{5}: commit: fixes f10ccfed (HEAD) HEAD@{6}: commit: refactoring
所以你需要的是:
git checkout master # assuming you were on master git reset --hard HEAD@{1}
rebase-merge
rm -rf .git/rebase-merge