Thread (1 message) 1 message, 1 author, 2016-06-15

Re: How to prevent empty git commit --amend

From: Matthieu Moy <hidden>
Date: 2016-06-15 23:03:28

Ivo Anjo [off-list ref] writes:
Hello,

On Wed, Jan 14, 2015 at 10:00 AM, Matthieu Moy
[off-list ref] wrote:
quoted
[alias]
        amend = !git diff --staged --quiet || git commit --amend

and then use "git amend".
Genius! This is exactly what I wanted, thanks!
You probably want to tweak the alias by adding a && echo "Nothing to
commit, sorry" (or an if/then/fi) after git diff to get the appropriate
error message though.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help