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

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


当前回答

通过下列方式查看日志来查找上次承诺的散列代码 :

git log

然后

git reset <the previous co>

其他回答

enter image description here

假设您在视觉工作室工作, 如果您进入分支历史, 并查看您的所有承诺, 只需在承诺之前选择事件, 您想要撤销, 右单击它, 然后选择Revert轻而易举

#1) $ git commit -m "Something terribly misguided" 
#2) $ git reset HEAD~                              

[必要时编辑文件]

 #3) $ git add .
#4) $ git commit -c ORIG_HEAD  

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

一些命令 :

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

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

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

使用此命令 :

git checkout -b old-state number_commit