簡體   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