14

Is there a way to change the comment of a particular old(not latest/one behind) commit which is already pushed to the remote repository in git? There are no changes in the content of the commit. I only need to change the comment which I made which is a total error!

Thanks

user1221558
  • 151
  • 6
  • Have other people already pulled from your repo? If not you could rebase and do a `git push --force` – FDinoff Jun 13 '13 at 02:55

2 Answers2

3

I'm not sure you're going to be able to if it's not the latest push. How do I edit an incorrect commit message in git (I've pushed)?

Community
  • 1
  • 1
mayorbyrne
  • 495
  • 1
  • 5
  • 16
0

Maybe two ways to resolve your problem :

> If your pushed commit is the last on your branch

Remove your remote branch, "git reset --soft HEAD~1", commit with your new message, and push your branch again.

> If your pushed is in the middle of the branch

Remove your remote branch, "git rebase -i " where is your commit place, choose "edit" for your commit, and push your branch again.

Remove/Create remote branch is very tricky... So take care to prevent your team first ;)

Thierry Nowak
  • 206
  • 2
  • 6