我怎样才能回滚一个github库到特定的提交? [英] How can I rollback a github repository to a specific commit?
问题描述
我的github现在有100个提交。我需要回滚仓库提交80,并删除所有后续的。
为什么?
这个回购应该是用于从其他用户合并。由于过度编辑,一堆合并进入我的提交。这是由于我的远程分支的标签错误,其中3个开发者被标记为彼此。我需要重置到这一点,然后向前拉。
我想重新绑定,如下例所示:如何删除GitHub上的提交?
但是,git希望我做很多冲突管理。是否有一种更简单的方法?
git reset --hard&old-commit -id>
git push -f< remote-name> <分支名称>
注意:正如下面的评论中所写,在协作环境中使用它很危险: '重写历史记录
My github has 100 commits in it right now. I need to rollback the repository to commit 80, and remove all the subsequent ones.
Why? This repo is supposed to be for merging from miscellaneous users. A bunch of merges went in as commits from me, due to excessive editing. That was due to a mislabeling of my remote branches, where 3 developers were labeled as each other. I need to reset to that point, and then pull forwards.
I wanted to rebase, as in this example: How can I remove a commit on GitHub?
However, git wants me to do a lot of conflict management. Is there a simpler way?
git reset --hard <old-commit-id>
git push -f <remote-name> <branch-name>
Note: As written in comments below, Using this is dangerous in a collaborative environment: you're rewriting history
这篇关于我怎样才能回滚一个github库到特定的提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!