Due to some bad cherry-picking, my local Git repository is currently five commits ahead of the origin, and not in a good state.
(由于一些糟糕的挑选,我的本地Git存储库目前在原点之前提交了五个提交,并且状态不佳。)
I want to get rid of all these commits and start over again. (我想摆脱所有这些提交并重新开始。)
Obviously, deleting my working directory and re-cloning would do it, but downloading everything from GitHub again seems like overkill, and not a good use of my time.
(显然,删除我的工作目录并重新克隆会这样做,但是再次从GitHub下载所有内容似乎有些过分,而且不能很好地利用我的时间。)
Maybe git revert
is what I need, but I don't want to end up 10 commits ahead of the origin (or even six), even if it does get the code itself back to the right state.
(也许git revert
是我需要的东西,但是我不希望在原点(甚至六个)之前结束10次提交,即使它确实让代码本身恢复到正确的状态。)
I just want to pretend the last half-hour never happened. (我只想假装最后半小时从未发生过。)
Is there a simple command that will do this?
(是否有一个简单的命令可以做到这一点?)
It seems like an obvious use case, but I'm not finding any examples of it. (这似乎是一个明显的用例,但我没有找到它的任何例子。)
Note that this question is specifically about commits , not about:
(请注意,这个问题具体是关于提交 , 而不是关于:)
- untracked files
(未跟踪的文件)
- unstaged changes
(未分期的变化)
- staged, but uncommitted changes
(上演但未提交的变更)
ask by David Moles translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…