简体   繁体   中英

How to revert multiple files (but not all) to a past commit?

I need to revert a bunch of files (about 40-50) to a specific commit. However, I don't want to revert all the files. How do I do that without doing a per-file checkout for each of the files I need to revert? All the files I need to revert are located under a single folder.

I already found out the solution.

git checkout master~1 ./FolderIWantToRevert ./AnotherFolderToRevert

Do note that I wanted to revert to the previous commit, that's why there's the ~1 after master .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM