如何在git中检出旧版本的文件夹

sol*_*gar 6 git

我需要从原点拉出变化.问题是其中一个lib已更新到最新版本,它崩溃了我的部分应用程序.我想拉最近的更改,然后回到以前(或特定)版本只有一个文件夹,其中包含导致lib的问题.有没有办法做到这一点?

Bol*_*wyn 11

git checkout LAST_WORKING_COMMIT -- vendor/library/in/question
Run Code Online (Sandbox Code Playgroud)

这将检出版本中的文件夹LAST_WORKING_COMMIT.但是,git status然后会告诉您文件被修改:

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   vendor/library/in/question/file.exe
#
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)


use*_*342 7

使用附加参数git checkout:

git checkout REV -- folder
Run Code Online (Sandbox Code Playgroud)