Git是一个惊人的工具,但我还没有想到解决推送的更改的最佳方法。 这是情况。
我在一个分支上,并推动了几次提交给GitHub。 从那时起,我们已经决定,我已经放弃了兔子洞,我们需要取消我已经完成的一些提交,并重新开始。 从本质上讲,我需要将所有推送的提交反转回前一个提交。 以下是我认为合适的两个命令
git revert # - creates a new commit that "undoes" the changes of one specific commit git checkout 'commit SHA' # - sets the head to that specific commit, wherein I will re-push to the repo, undoing my changes... I think那么,我说得对吗? 我是否需要对我想要返回的特定提交进行git结账? 或者在这个令人费解的过程中有什么我不了解的东西?
谢谢。
Git is a phenomenal tool, but I have yet to wrap my mind around the best way to undo pushed changes. Here's the situation.
I'm on a branch, and have pushed several commits to GitHub. It has since been decided that I've gone too far down the rabbit hole, and we need to scrap several of the commits I've done, and start over. Essentially, I need to reverse all of the pushed commits, back to a previous one. Here are the two commands that I think are appropriate
git revert # - creates a new commit that "undoes" the changes of one specific commit git checkout 'commit SHA' # - sets the head to that specific commit, wherein I will re-push to the repo, undoing my changes... I thinkSo, am I right? Do I need to do a git checkout on the specific commit I want to return to? Or is there something in this convoluted process that I am not understanding?
Thanks.
最满意答案
尝试git reset : http : //git-scm.com/docs/git-reset
Try git reset: http://git-scm.com/docs/git-reset
更多推荐
发布评论