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):
git rebase -i <hash-of-commit-preceding-the-incorrect-one>
- in editor opens, change
pick
reword
on line incorrect commit. - save file , close editor.
- the editor open again incorrect commit message. fix it.
- save file , close editor.
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
Post a Comment