How to check out the old version of a folder in git

I need to pull changes from source. The problem is that one of the libraries was updated to the newest version and my part of the application crashed. I would like to make the latest changes and then revert to the previous (or specific) version for just one folder that contains this issue calling lib. Is there a way to do this?

+3


source to share


2 answers


git checkout LAST_WORKING_COMMIT -- vendor/library/in/question

      

This will check the folder in version LAST_WORKING_COMMIT

. However, it git status

will report that the files have changed:



$ 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")

      

+8


source


Use an additional argument git checkout

:



git checkout REV -- folder

      

+6


source







All Articles