git回退到指定版本的代码

1. 查看所有的历史版本,获取你git的某个历史版本的id, git log


2. 回退本地代码库:git reset --hard  {commitId},将本地文件回滚: 

$ git reset --hard  93330ca1076ac8b60586b55e821b098653a1b442

HEAD is now at 93330ca1076ac8b60586b55e821b098653a1b442add a constellation test case

 

3. 推送到远程服务器:git push -f -u origin master 或者直接执行 git push -f


4. 重新拉代码:git pull

 

posted on 2021-05-21 18:23  lewisat  阅读(1131)  评论(0编辑  收藏  举报

导航