我做了git checkout -b profile
,并对该分支做了一些更改。
我不喜欢这些更改,并且想要从master
分支取回我的代码而没有profile
分支的更改。
但是,当我执行git checkout master
时,我看到了profile
分支中的更改。
有没有办法找回以前的代码?
答案 0 :(得分:0)
您可以看到更改,因为更改没有在profile
分支中提交。
尝试以下命令重置您的master
分支:
git checkout master
git pull
git reset --hard origin/master
它将使用仓库master
重设本地master
除上述内容外,您还可以从以下命令中删除不需要的更改
git checkout file1name file2name
如果要删除所有未提交的更改,可以使用
git checkout .