Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify commit message with revert --continue

Tags:

git

git-revert

How can I supply a message with the revert --continue command (i.e. after performing a revert and then resolving conflicts)?

revert --continue tries to pop up a message editor (fails on my system -- different question), but if I try this:

git revert --continue -m "Reverted blah blah and resolved conflicts"

I discover that git revert has a -m parameter for a different purpose.

I don't see any other message-related parameters in the documentation. Is there some common option not listed?

like image 993
explunit Avatar asked Dec 16 '14 15:12

explunit


2 Answers

Run git revert --no-commit <SHA> and then git commit -m "<message>"

like image 78
Raman Zhylich Avatar answered Oct 16 '22 05:10

Raman Zhylich


As an alternative to Raman Zhylich's answer:

git revert <SHA>
git commit --amend -m "<message>"

or if you wanna get real fancy and actually append something to the merge-commit's message.

oldSubject="$(git log -1 --format="%s")"
oldBody="$(git log -1 --format="%b")"
git commit --amend -m "$(echo -e "$oldSubject\n\n$oldBody\n\nfootnote: I'm a good boy.")"
like image 26
leondepeon Avatar answered Oct 16 '22 05:10

leondepeon