我无意间把错误的档案 写错给Git 基特,但还没有将承诺推进到服务器上。

我如何解除那些承诺?当地当地仓库?


当前回答

我发现这笔该网站描述如何撤销您在存储库中的承诺 。

一些命令 :

git commit --amend        # Change last commit
git reset HEAD~1 --soft   # Undo last commit

其他回答

使用此命令 :

git checkout -b old-state number_commit

我拿到了身份证明bitbucket并随后:

git checkout commitID .

示例:

git checkout 7991072 .

它又把它恢复到那个承诺的工作副本上。

如果你还想背到最后承诺 并改过历史

在命令下方使用, 表示您想要跳到前一个任务, 因为前一个任务已经存在 ID SHA -71e2,e57458bde883a37b332035f784c6653ec509中,您可以指向此承诺,在此承诺之后不会显示任何日志消息,此后所有历史都将被删除。

git 推进源 + 71e2e57458bde883a37b332035f784c6653ec509: 技术主管

这将添加一个新的承诺, 删除所添加的文件 。

git rm yourfiles/*.class
git commit -a -m "deleted all class files in folder 'yourfiles'"

或者您可以重写历史来撤销最后一项承诺 。

警告警告警告警告:此命令将永久删除对《京都议定书》的修改.java您承诺的文件( 和任何其他文件) -- 从工作目录中删除全部修改 :

git reset --hard HEAD~1

缩略hard resetHEAD-1您的工作副本将在您错误犯罪之前设定为犯罪状态 。

在视觉工作室中,只需返回您的承诺, 然后将它与自动创建的返回承诺一起推。 全部显示在下面的屏幕镜头中 。 @ info: status

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here