How to restore a whole directory from history of git repository?

后端 未结 3 1673
滥情空心
滥情空心 2020-12-07 14:30

I would like to restore a whole directory (recursively) from the history of my git repository.

There is only 1 branch (master).

I know the commit where error

3条回答
  •  被撕碎了的回忆
    2020-12-07 14:45

    If you simply do git checkout then it will temporarily move you to that sha-commit.

    Each commit object holds the entire structure of the disk at that time, so if you have files there and need to copy them out, you can do so. Warning though, you will not be in any branch, so you'll have to move back to master before copying the file into your working tree and commit it.

提交回复
热议问题