Git回滚代码

回滚命令:

1.回退到上个版本

$ git reset --hard HEAD^

2.回退到前2次提交之前,以此类推,回退到n次提交之前

$ git reset --hard HEAD~2

3.退到/进到 指定commit的sha码

$ git reset --hard commit_id

然后强推到远程:

$ git push origin HEAD --force

猜你喜欢

转载自www.cnblogs.com/Dev0ps/p/11614023.html
今日推荐