[英]how to revert one single file of a commit with multiple files
Assume that I have committed 5 files.假设我已经提交了 5 个文件。 After I have committed I have noticed that I need to undo changes on one file of these 5 files.
提交后,我注意到我需要撤消对这 5 个文件中的一个文件的更改。 Is this possible?
这可能吗? if not what is the best why to undo the changes on one file?
如果不是最好的,为什么要撤消对一个文件的更改?
Expanding (and with a little adjustment on his comment) from ChatterOne, if what you want to is amend the revision (and forget about the bad revision):从 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.