Re: How to prevent empty git commit --amend

2015-01-14 Thread Junio C Hamano
Junio C Hamano writes: > Matthieu Moy writes: > >> Ivo Anjo writes: >> >>> Is there a way to prevent a *git commit --amend** with nothing to >>> commit from working? >>> If not, I would like to suggest that this feature would be very helpful :) >> >> I don't know any way to let Git do the check

Re: How to prevent empty git commit --amend

2015-01-14 Thread Junio C Hamano
Matthieu Moy writes: > Ivo Anjo writes: > >> Is there a way to prevent a *git commit --amend** with nothing to >> commit from working? >> If not, I would like to suggest that this feature would be very helpful :) > > I don't know any way to let Git do the check for you, but > > git diff --stage

Re: How to prevent empty git commit --amend

2015-01-14 Thread Matthieu Moy
Ivo Anjo writes: > Hello, > > On Wed, Jan 14, 2015 at 10:00 AM, Matthieu Moy > wrote: >> [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

Re: How to prevent empty git commit --amend

2015-01-14 Thread Ivo Anjo
Hello, On Wed, Jan 14, 2015 at 10:00 AM, Matthieu Moy wrote: > I don't know any way to let Git do the check for you, but > > git diff --staged --quiet || git commit --amend > > should do it. You can alias it like > > [alias] > amend = !git diff --staged --quiet || git commit --amend > > a

Re: How to prevent empty git commit --amend

2015-01-14 Thread Matthieu Moy
Ivo Anjo writes: > Is there a way to prevent a *git commit --amend** with nothing to > commit from working? > If not, I would like to suggest that this feature would be very helpful :) I don't know any way to let Git do the check for you, but git diff --staged --quiet || git commit --amend sh

Re: How to prevent empty git commit --amend

2015-01-13 Thread Michael J Gruber
Ivo Anjo schrieb am 13.01.2015 um 11:22: > Hello Daniel, > > Thanks for your answer! > > My issue is not with cancelling the amend commit, is that because the > amend commit already lists changes to the files I am working on (those > changes that already went in the commit I was ammending), I don

Re: How to prevent empty git commit --amend

2015-01-13 Thread Ivo Anjo
Hello Daniel, Thanks for your answer! My issue is not with cancelling the amend commit, is that because the amend commit already lists changes to the files I am working on (those changes that already went in the commit I was ammending), I don't realize that I forgot to add what I changed. For ins

Re: How to prevent empty git commit --amend

2015-01-13 Thread Daniel Knittl-Frank
On Tue, Jan 13, 2015 at 9:56 AM, Ivo Anjo wrote: > Hello, > > I sometimes get a bit distracted when making amends. Once or twice per > week I do a commit, then realize I added something I shouldn't, or > forgot to add a line here or there, and then I do a git commit --amend > to fix it. > > The th

How to prevent empty git commit --amend

2015-01-13 Thread Ivo Anjo
Hello, I sometimes get a bit distracted when making amends. Once or twice per week I do a commit, then realize I added something I shouldn't, or forgot to add a line here or there, and then I do a git commit --amend to fix it. The thing is, a lot of times I forget to stage the modifications I did