简体   繁体   中英

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

Assume that I have committed 5 files. After I have committed I have noticed that I need to undo changes on one file of these 5 files. 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):

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

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