My ideal workflow would consist of the following steps
I cannot use git commit -a --amend -m "new commit message"
, because this commits the new changes as well. I'm not sure that I want to bother with staging or branching. I wish I could just edit the commit message without committing any new changes. Is it possible?
use git commit --amend to make changes, or. use git reset @~ to discard the last commit, but not the changes to the files (i.e. take you to the point you were at when you'd edited the files, but hadn't committed yet).
You can change the most recent commit message using the git commit --amend command. In Git, the text of the commit message is part of the commit. Changing the commit message will change the commit ID--i.e., the SHA1 checksum that names the commit. Effectively, you are creating a new commit that replaces the old one.
There's no need to stash or do anything else here.
git commit --amend -m 'Your new message.'
will not commit any new changes (note the lack of -a
flag), provided that you haven't explicitly added them to the index (using git add
, for example).
Just:
$ git stash
$ git commit --amend -m "Your Modified Message"
$ git stash apply
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With