如何更改bitbucket中的git commit消息 [英] how do I change a git commit message in bitbucket
本文介绍了如何更改bitbucket中的git commit消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在BitBucket中更改旧的git commit消息。我尝试了 git rebase -i
并重新编写了我的消息,但是当我提交并提交时,它只是将旧消息保存在BitBucket中并合并我的更改。
I need to change an old git commit message in BitBucket. I tried git rebase -i
and reworded my message but when I pulled and committed it just kept the old message in BitBucket and merged my changes in.
推荐答案
这基本上是4个步骤的过程。但是,如果多个团队成员在同一个分支上工作并拥有自己的副本,则有点冒险。 (如果你是唯一处理它的人,就去做吧)
It's basically 4 step process. But a bit risky if multiple team member are working on the same branch and have their own copies. (If you are the only one working on it, go for it)
这个git手册精美地解释了它:修改旧的或多个提交信息
This git manual explains it beautifully: Amending older or multiple commit messages
-
git rebase -i HEAD〜X
(X =您要更改的提交消息数量) - 上面的命令将在编辑器中打开git文件。在这里用'reword'替换文本'pick'并保存文件。
- 它会为每个提交一个一个打开编辑器,然后再次更改提交消息。 b $ b
- 最后:
git push -f
git rebase -i HEAD~X
(X=No of commit messages you want to change)- Above command will open git file in editor. There replace text 'pick' with 'reword' and save the file.
- It will open editor for every commit one by one, there you again change the commit message.
- At the end:
git push -f
这篇关于如何更改bitbucket中的git commit消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文