git 版本回退 命令版

git code rollback

# 查看历史提交版本 commit_id
git reflog
$ git reflog
7bddf865 (HEAD -> annotation, origin/annotation) HEAD@{0}: commit: rechange test client
e26b74cb HEAD@{1}: commit: change test client
dcb04b86 HEAD@{2}: checkout: moving from 8258c0198335601ebb6445f23272e74f4b8fb787 to service_pod_annotation
8258c019 HEAD@{3}: commit: change test client
d9d98008 HEAD@{4}: checkout: moving from service_pod_annotation to d9d98008498e7c3a662e54788d8b34a111475a51
# 选择回退版本的commit_id
git reset --hard 8258c019 
# 在当前的代码版本上做修改后
git add .
git pull origin annotation
git commit -m "xxx"
git push origin annotation

你可能感兴趣的:(git,git,github)