假设有下面三次提交,我们想回滚到commit 1:
- commit 3
- commit 2
- commit 1
# 回滚到某个版本,参数是要回滚到commit-id git reset --soft commit-id
# 备份到本地缓存,以防万一 git stash
# 将本地master push 到远程版本库中, -f 强制覆盖。 git push -f
影响:
- 会丢掉之后别人提交的内容
- 如果其他人已经更新了代码,需要其他人在自己的本地也回滚一下
- 提交代码时千万注意安全啊
假设有下面三次提交,我们想回滚到commit 1:
# 回滚到某个版本,参数是要回滚到commit-id git reset --soft commit-id
# 备份到本地缓存,以防万一 git stash
# 将本地master push 到远程版本库中, -f 强制覆盖。 git push -f
影响: