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

Eric Noulard eric.noulard at gmail.com
Sat May 1 10:51:48 EDT 2010


2010/5/1 Ben Boeckel <mathstuf at gmail.com>:
> Alexander Neundorf <neundorf at kde.org> wrote:
>> 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:
>>
> <snip>
>>
>> What should I do ?
>> Get a fresh clone, apply the patch, remove the trailing whitespace, commit,
>> then push ?
>> (would be quite a lot of work for removing one space...)

I read this too fast, this is near to my solution so no so useful.

> Hi,
>
> What I would do in this case is an interactive rebase.
>
>    git rebase -i origin/master
>
> This allows you to reorder commits, reword commit messages, edit
> commits, and squash commits together. To fix this, take the commit which
> fixes the trailing whitespace and put its line below the one which added
> it. Change its command to 'fixup' (1.7 or later, 'squash' is available
> as well but involves manual commit message editing) and the save the
> file and exit your editor. Git will then replay your commits and handle
> your commands. Hope this helps.

Very interesting, I'll try that next time.

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



More information about the cmake-developers mailing list