0

If I want to change a past commit message, I know I can do

git reset HEAD .
git commit --amend -m "Correct commit message"

or

git stash save "WIP"
git rebase -i HEAD~

but is there any way to do it without stashing current work (or, for --amend, making sure no changes are staged)?

This is for a commit that hasn't yet been pushed (or has been pushed into a feature branch that hasn't yet been merged).

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
  • Are you asking about an already-`push`ed or not-yet-`push`ed commit? – eirikir Aug 27 '15 at 23:57
  • @eirikir not yet pushed. – Andrew Grimm Aug 28 '15 at 00:31
  • 1
    @eirikir I've mentioned some details in this question that are in addition to what's in that question. I've also mentioned why I suspect `git commit --amend` and `git rebase` may not be suitable in this case. – Andrew Grimm Aug 28 '15 at 00:35
  • 1
    Sorry! I was reading fast and missed that part. Idk how to edit my flag, but I think the answer is here: http://stackoverflow.com/a/25375850/1569930 – eirikir Aug 28 '15 at 00:42

1 Answers1

0

It can depend on whether you've pushed the changes up to the remote already or not.

If you haven't you can simply use the command git commit --amend on the CLI. Else you could look into interactive rebasing.

There is some pretty good info over on help.github.com about changing commit messages which can be seen here.

Hope that helps!

Jhey
  • 1,377
  • 7
  • 10