Accidentally pushed commit: change git commit message -


in local repo have 1 commit incorrect commit message.

i've published incorrect commit message git push.

now remote repo (which github-hosted) has incorrect commit message, too.

i've tried git commit --amend, found not work me in situation because i've made additional commits since incorrect one.

how fix situation?

easiest solution (but please read whole answer before doing this):

  1. git rebase -i <hash-of-commit-preceding-the-incorrect-one>
  2. in editor opens, change pick reword on line incorrect commit.
  3. save file , close editor.
  4. the editor open again incorrect commit message. fix it.
  5. save file , close editor.
  6. git push --force update github.

this mean publishing modified version of published repository. if pulled or fetched repo between when made mistake incorrect commit message, , when fixed it, experience difficulties later. sure can accept consequence before trying this.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -