使用Git重置或还原特定的文件到特定的修订?我对一个文件进行了一些更改,该文件已作为文件组的一部分提交了几次,但现在希望将对其的更改重置/还原回以前的版本。我做了一个git log连同一个git diff要找到我需要的修订,但不知道如何将文件恢复到以前的状态。
3 回答

慕桂英546537
TA贡献1848条经验 获得超10个赞
git diff <commit hash> <filename>
git reset <commit hash> <filename>
--hard
git checkout <commit hash> git checkout -b <new branch name>
git checkout <my branch> git rebase master git checkout master git merge <my branch>

HUWWW
TA贡献1874条经验 获得超12个赞
git checkout [commit-ref] -- [filename]
- 3 回答
- 0 关注
- 2114 浏览
添加回答
举报
0/150
提交
取消