Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change a git commit message in Bitbucket?

Tags:

git

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.

like image 882
MonkeyBonkey Avatar asked Jan 17 '13 14:01

MonkeyBonkey


People also ask

How do I change an existing commit message?

On the command line, navigate to the repository that contains the commit you want to amend. Type git commit --amend and press Enter. In your text editor, edit the commit message, and save the commit.

Can you edit git commit message?

To change the most recent commit message, use the git commit --amend command. To change older or multiple commit messages, use git rebase -i HEAD~N . Don't amend pushed commits as it may potentially cause a lot of problems to your colleagues.


1 Answers

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)

This git manual explains it beautifully: Amending older or multiple commit messages

  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
like image 51
Jadav Bheda Avatar answered Oct 01 '22 20:10

Jadav Bheda