git add 之后没有push 怎么找回代码?

1、git add 而且 commit 

解决方法:回退版本

查看命令版本

git reflog 

回到版本

git reset --hard ID前四位

https://blog.csdn.net/weixin_41477306/article/details/95870289

2、git add ,没有 commit 

解决方法:在git缓存里面找

查看近60条缓存

find .git/objects -type f | xargs ls -lt | sed 60q

查看某个缓存

git cat-file -p ID

https://blog.csdn.net/yeluosc/article/details/76690678

猜你喜欢

转载自blog.csdn.net/lzq_20150715/article/details/104551349