[cmake-developers] git doesn't let me push: bad whitespace at end of line

Eric Noulard eric.noulard at gmail.com
Sun May 2 05:29:51 EDT 2010


2010/5/2 Michael Wild <themiwi at gmail.com>:
>
>
> On Sat, May 1, 2010 at 4:49 PM, Eric Noulard <eric.noulard at gmail.com> wrote:
>>
>> 2010/5/1 Alexander Neundorf <neundorf at kde.org>:
>> > Hi,
>> >
>> > I tried to push a commit to master, but this failed because git
>> > complained
>> > that the patch adds a trailing whitespace in one line.
>> > So I removed this whitespace and committed this.
>> > But git still doesn't push, I guess because the commit which adds the
>> > whitespace is still there:
>>
>> I did have that trouble once.
>>
>> What I did was:
>>     1) save a diff between offending commit and the current tree.
>>         git diff <commitid-ok> HEAD > put-aside.patch
>>
>>     2) reset the clone to commit-ok
>>         git reset --hard commitid-ok
>>
>>     3) apply the put aside patch
>>
>>     4) fix the offending space
>>
>>     5) commit
>>
>>     6) push
>>
>> This may not be the most easiest way to do it but it worked for.
>> I would be glad to know 'the definitive right way to do it'...
>>
>>
>
> Much too complicated ;-)

I was pretty sure of that :-)

> If the offending commit is also HEAD, use "git commit --amend". If the
> commit is older, you can use the following:

[...]

thank you for this thorough explanation.
I'm beginning to understand the joy of git.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org



More information about the cmake-developers mailing list