简体   繁体   English

GIT:如何从工作目录中检出所有文件?

[英]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. 使用Xcode时,我不小心打开了.xib文件。 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. 如果生成文件的Xcode版本与我的版本不同,它会自动将这些文件标记为已修改(M),并且也会显示在我的git中。 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. 选择相关的.xib文件,右键单击/按住Control键单击选择,然后选择“放弃所选文件中的更改”选项。 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) 这会将文件还原到其存储的版本(这与git checkout命令等效,因为它将从已更改文件的列表中删除文件)

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. 为了安全起见,我倾向于在“版本”模式下查看xib文件,以确保在执行此操作之前仅更改Xcode版本模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从文档目录中删除所有文件后,UITableView无法重新加载 - UITableView is not reloading after I delete all files from Document Directory 如何删除 .exec 扩展名 git 适用于文件? - How do I remove the .exec extension git applies to files? 因为我可以将所有文件从Objective-C中的一个目录移动到另一个目录? - as I can move all files from one directory to another directory in Objective-C? 如何在App Sandbox中将文件添加到/ Documents目录 - How do I add files to /Documents directory in App Sandbox AWS IOS SDK v2.0:如何获取存储桶中的所有文件夹,然后从所述文件夹中提取所有文件? - AWS IOS SDK v2.0: How do I get all the folders within a bucket, and then pull all the files from said folders? iOS将所有文件从远程目录保存在本地文档目录中 - iOS save all files from remote directory at local document directory 如何获取“文档”目录中文件的所有路径? - How to get All paths for files in Documents directory? 如何遍历目录中的所有图像文件? - How to iterate over all image files in a directory? 如何从目录读取文件 - how to read files from directory 我如何在 Xcode 中找到所有不是目标成员的文件 - How do I find all files in Xcode that are NOT a member of a target
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM