我在承诺信中写错了。

我怎么能改變訊息呢?承諾尚未推動。


当前回答

我喜欢使用以下内容:

git status git add --all git commit -am “消息走到这里关于变化” git pull <origin master> git push <origin master>

其他回答

我喜欢使用以下内容:

git status git add --all git commit -am “消息走到这里关于变化” git pull <origin master> git push <origin master>

如果这是你的最后承诺,只需修改承诺:

git commit --amend -o -m "New commit message"

如果这是一个埋葬的承诺,使用令人惊叹的互动折叠:

git rebase -i @~9   # Show the last 9 commits in a text editor


运行 vimtutor 如果你有时间 hjkl 匹配运动密钥 ← ↓ ↑→ 所有命令都可以用“范围”预定,例如 3j 移动下三个行 i 输入输入模式 - 文本你输入将显示在文件 Esc 或 Ctrlc 输出输入模式和返回“正常”模式 u 到 undo Ctrlr 重定向 dd, dw, dl 删除一个行,字,或字母, 相应 cc, cw, cl 更改一个行,字母,或字母, re

如果你编辑了很多文本,然后转到Dvorak键盘配置,学习触摸类型,并学习Vim。

此分類上一篇


ProTipTM: 不要害怕使用重写历史的“危险”命令进行实验* - Git 不会默认删除您的订单 90 天; 您可以在重写中找到它们:

$ git reset @~3   # Go back three commits
$ git reflog
c4f708b HEAD@{0}: reset: moving to @~3
2c52489 HEAD@{1}: commit: more changes
4a5246d HEAD@{2}: commit: make important changes
e8571e4 HEAD@{3}: commit: make some changes
... earlier commits ...
$ git reset 2c52489
... and you're back where you started

我添加了 Aliases reci 和 recm for recommit (amend) 它. 现在我可以用 git recm 或 git recm -m:

$ vim ~/.gitconfig

[alias]

    ......
    cm = commit
    reci = commit --amend
    recm = commit --amend
    ......

如果您正在使用 Git GUI 工具,则有一个按钮称为 修改最后的承诺. 点击该按钮,然后它将显示您的最后的承诺文件和消息. 只需编辑该消息,您可以承诺它一个新的承诺消息。

或使用此命令从控制台/终端:

git commit -a --amend -m "My new commit message"

我使用Git GUI尽我所能,这给了你更改最后的承诺的选项:

此分類上一篇

此外, git rebase -i 起源/masteris 一个可爱的 mantra 将始终向您介绍您在主人的顶部所做的承诺,并为您提供更改、删除、重新订单或破坏的选项。