繁体   English   中英

如何使用多个文件恢复一个提交的单个文件

[英]how to revert one single file of a commit with multiple files

假设我已经提交了 5 个文件。 提交后,我注意到我需要撤消对这 5 个文件中的一个文件的更改。 这可能吗? 如果不是最好的,为什么要撤消对一个文件的更改?

从 ChatterOne 扩展(并对他的评论稍作调整),如果您想要修改修订版(并忘记错误的修订版):

git checkout HEAD~ -- path-to-file
git commit --amend --no-edit # replace the revision that I just created with this new revision I'm creating

暂无
暂无

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

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