3 回答
TA贡献1820条经验 获得超10个赞
git reflog
HEAD
).
git reflog name-of-my-branch
如果您的提交不在重发中
git fsck --full --no-reflogs --unreachable --lost-found | grep commit | cut -d\ -f3 | xargs -n 1 git log -n 1 --pretty=oneline > .git/lost-found.txt
git config --global alias.rescue '!git fsck --full --no-reflogs --unreachable --lost-found | grep commit | cut -d\ -f3 | xargs -n 1 git log -n 1 --pretty=oneline > .git/lost-found.txt'
git rescue
git cat-file -p 48540dfa438ad8e442b18e57a5a255c0ecad0560
git log -p 48540dfa438ad8e442b18e57a5a255c0ecad0560
git branch commit_rescued 48540dfa438ad8e442b18e57a5a255c0ecad0560
TA贡献1848条经验 获得超6个赞
git checkout <sha> git checkout -b <branch>
git checkout -b <branch> <sha>
A 更清洁(更简单)的解决方案<sha>
git reflog
):
git branch <branch> <sha>
<sha>
.
<sha>
git branch -m <restored branch> <final branch>
<sha>
- 3 回答
- 0 关注
- 2671 浏览
添加回答
举报