0

After making use of the command to stage, commit and push all at once I asked for here Git command to commit all changes including files removed or created, I've typed the wrong commit message and then pushed it to my Github account. I'm the only contributor to my repo so there's no pulling issues to fear.

I've followed the advice given here Changing git commit message after push (given that no one pulled from remote) and here Edit an incorrect commit message in Git that has already been pushed which is basically to do:

git commit --amend

which opens up my text editor (Sublime) displaying the message of the last commit. Once in there I modify this message, save and close the file. After that I type:

git push origin master --force

which appears to work fine. But if I now do a :

git log

I keep seeing the wrong (ie: the old) message in my last commit and my Github account shows no changes whatsoever. What am I doing wrong?

Community
  • 1
  • 1
Gabriel
  • 40,504
  • 73
  • 230
  • 404

1 Answers1

3

In my experience Sublime doesn't work well with git propmts. Try passing the correct message directly with

git commit --amend -m <message>

and see if it works.

If it does you might have to switch to gVim or some other editor, that uses a single process.

I don't exactly know what the problem is with Sublime Text but I guess the first process just spawns another one and quits. Because of this git thinks the editing is finished and commits before you actually modified the file.

jacob1123
  • 361
  • 3
  • 12
  • what platform are you running Sublime on? have you seen http://www.sublimetext.com/docs/2/osx_command_line.html – tcovo Nov 29 '13 at 15:29
  • 1
    Yep, that was it. I applied this solution and it worked, I would have never guessed `Sublime` was the issue. I'll switch back to editing in `leafpad`. Thank you very much! PS: @tcovo I use elementary OS which is based on Ubuntu 12.04. – Gabriel Nov 29 '13 at 15:45