简体   繁体   中英

GIT: How do I checkout all files from working directory?

I want to discard all files to which changes have been made.

While working with Xcode, I accidentally open .xib files. If the version of Xcode in which the files were generated is different than my version, it automatically marks these files as Modified (M) and it shows up in my git as well. I need to manually remove all of the file. I'm sure there must be a better way to do it.

git reset --hard

will reset to the committed state,

git checkout -- .

will check out the staged state

Select the .xib files in question, right click/control-click on your selection, and select the "Discard changes in selected files" option. This will revert the files back to their stored versions (it's the equivalent of the git checkout command in that it removes the file from the list of changed files)

For safety, I tend to view the xib files in Version mode to ensure that only the Xcode version boilerplate is changing before I do this.

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