如何更改bitbucket中的git commit消息 [英] how do I change a git commit message in bitbucket

查看:806
本文介绍了如何更改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


  1. git rebase -i HEAD〜X (X =您要更改的提交消息数量)

  2. 上面的命令将在编辑器中打开git文件。在这里用'reword'替换文本'pick'并保存文件。
  3. 它会为每个提交一个一个打开编辑器,然后再次更改提交消息。 b $ b
  4. 最后: git push -f

  1. git rebase -i HEAD~X (X=No of commit messages you want to change)
  2. Above command will open git file in editor. There replace text 'pick' with 'reword' and save the file.
  3. It will open editor for every commit one by one, there you again change the commit message.
  4. At the end: git push -f

这篇关于如何更改bitbucket中的git commit消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆