我是git的初学者,我对4个文件进行了更改,添加并提交了更改。然后从master获取新的更新并将所有内容推送到master。在打开pull请求时,我看到一个显示代码更改的文件我还没有制作。如何在提交中恢复对该特定文件的更改?
答案 0 :(得分:0)
git checkout <commit hash> <file path> # Give me an older state of this file
git commit -a # Commit older file
或:
git revert --no-commit <commit hash> # Revert commit, but let me make changes
git reset # Unstage everything
git add <file path> # Stage only desired file
git checkout -- . # Discard all unstaged changes
git commit