Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git 撤销远程仓库的错误提交 #41

Open
shuangmianxiaoQ opened this issue May 17, 2019 · 0 comments
Open

Git 撤销远程仓库的错误提交 #41

shuangmianxiaoQ opened this issue May 17, 2019 · 0 comments
Labels
Git Git 使用问题总结

Comments

@shuangmianxiaoQ
Copy link
Owner

shuangmianxiaoQ commented May 17, 2019

  1. 在本地仓库,将代码回退到正确的那次Commit
git reset --hard [commit_id]
  1. 检查无误后进行代码提交

注意:回退后导致当前master指向的提交,落后于远程库的提交。
理论上这种情况下,Git是禁止推送到远程分支的,那么需要添加参数--force来强制提交。
这样会导致在此提交后面的提交记录会丢失,所以一定要慎用该参数

git push origin develop --force
@shuangmianxiaoQ shuangmianxiaoQ added the Git Git 使用问题总结 label May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Git Git 使用问题总结
Projects
None yet
Development

No branches or pull requests

1 participant