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

Ben Boeckel mathstuf at gmail.com
Sat May 1 09:47:19 EDT 2010


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...)
> 
> Alex

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.

--Ben




More information about the cmake-developers mailing list