我在承诺信中写错了。
我怎么能改變訊息呢?承諾尚未推動。
我在承诺信中写错了。
我怎么能改變訊息呢?承諾尚未推動。
当前回答
我添加了 Aliases reci 和 recm for recommit (amend) 它. 现在我可以用 git recm 或 git recm -m:
$ vim ~/.gitconfig
[alias]
......
cm = commit
reci = commit --amend
recm = commit --amend
......
其他回答
修正
这里有几种选择,你可以
git commit --amend
只要是你最后的承诺。
互动降落
否则,如果不是你的最后承诺,你可以做一个互动的折扣,
git rebase -i [branched_from] [hash before commit]
接下来,在互动的复制中,你只会添加编辑到这个承诺。当它出现时,做一个 git commit - 更改并修改承诺消息. 如果你想在这个承诺点之前旋转,你也可以使用 git reflog 并只会删除这个承诺。
git commit --amend -m "your new message"
要改變以前的承諾,做你想要的變化,並進行這些變化,然後執行
git commit --amend
这将打开一个文件在你的文本编辑器代表你的新的承诺消息. 它开始与文本从你的旧承诺消息。 改变承诺消息,如你想要,然后保存文件,然后停止你的编辑器完成。
要更改以前的承诺,并保持相同的日志消息,运行
git commit --amend -C HEAD
修复以前的承诺,通过完全删除它,运行
git reset --hard HEAD^
如果你想编辑多个承诺消息,运行
git rebase -i HEAD~commit_count
此命令启动您的编辑器. 标记第一个命令(您想要更改的命令)为“编辑”而不是“选择”,然后保存和输出您的编辑器。
git commit --amend
git rebase --continue
注意: 您也可以从 git commit 打开的编辑器“做您想要的更改” - 更改
您可以使用 git-rebase-reword
它旨在以同样的方式编辑任何承诺(不只是最后) - 修改
$ git rebase-reword <commit-or-refname>
它被命名为反对互动的行动,以改变一个承诺:“反对”。 查看此帖子和人 - 部分互动模式-
例子:
$ git rebase-reword b68f560
$ git rebase-reword HEAD^
我喜欢使用以下内容:
git status git add --all git commit -am “消息走到这里关于变化” git pull <origin master> git push <origin master>