C:在git中恢复丢失的承诺



我试图在我的git存储库中对我的次级分支进行一些更改。但是当我承诺时,我失去了所有的改变。现在,我的存储库就像我第一次克隆时一样(我将其从教授的存储库中克隆来进行作业(,然后丢失了所有工作!有没有办法取回这些更改?我无法使用reflog,因为我的最后一个提交是很久以前。查看图片pic1pic2

切换到您的secondary分支:

$ git checkout seconday  # now current branch is 'seconday'
$ git log                # see the commit history

Add未跟踪的文件,do Commit,然后 Push到远程 seconday

$ git add -A                 # add the untracked files
$ git commit -m 'Message'    # staged the changes
$ git push origin secondary  # push to remote 'secondary'

最新更新