git pull之后代码回退

本地分支做了一些修改,但是没有提交到远端,然后git pull origin release之后自己写的代码被覆盖了,通过以下命令恢复到git pull之前:
1.git reflog 查看历史记录
历史记录
2.git reset --hard 7caa5ca41
3.git log 与 git reflog
git log 查看的是当前分支的所有版本记录
git reflog 文档里面说的也很模棱两可,结合自己本地历史记录,应该是所有的git操作都记录在这了。包括分支的切换,拉取等。
https://git-scm.com/docs/git-reflog
Reference logs, or “reflogs”, record when the tips of branches and other references were updated in the local repository。reflogs,当本地仓库分支的tips(啥意思?)或者其他相关被更新的时候就会记录。

HEAD@{2} means "where HEAD used to be two moves ago", master@{one.week.ago} means "where master used to point to one week ago in this local repository"。HEAD@{2}意思是“两次移动钱HEAD曾在的位置”,master@{one.week.ago}意思是“本地仓库一周前master所在位置”
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值