Skip to content

如果本地git的A分支被误删了, A分支代码没有被push到远程,如何找到之前A的提交记录和代码? #19

Description

@ScoutYin

git reflog 可以查看所有分支的所有操作记录(包括已经被删除的 commit 记录和 reset 的操作)

例如执行 git reset --hard HEAD~1,退回到上一个版本,用git log则是看不出来被删除的commit_id,用git reflog则可以看到被删除的commit_id,知道这个id后即可执行git branch [branchName] [commit_id],就可以了

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GitAbout Git

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions