我无意间把错误的档案 写错给Git 基特,但还没有将承诺推进到服务器上。
我如何解除那些承诺?当地当地仓库?
我无意间把错误的档案 写错给Git 基特,但还没有将承诺推进到服务器上。
我如何解除那些承诺?当地当地仓库?
当前回答
我发现这笔该网站描述如何撤销您在存储库中的承诺 。
一些命令 :
git commit --amend # Change last commit
git reset HEAD~1 --soft # Undo last commit
其他回答
如果你有Git 外加已安装, 您可以运行git undo
撤消最近的承诺。git undo 3
将撤销最后三项承诺。
以下是网站:Oh shit, git!
.
这里有许多解密的秘方 如何在Git 中解决事情。其中一些是:
哦,该死,我需要改变 信息在我的最后一次承诺!
git commit --amend
# follow prompts to change the commit message
哦,我无意中把什么东西 给了主人 本来该在全新的树枝上!
# Create a new branch from the current state of master
git branch some-new-branch-name
# Remove the commit from the master branch
git reset HEAD~ --hard
git checkout some-new-branch-name
# Your commit lives in this branch now :)
你需要做简单快的动作
git commit --amend
是私人分行还是私人分行
git commit -m 'Replace .class files with .java files'
如果它是共享的或公共的分支。