1

i modified a file "index.php", and i want to apply a push for the second time so i apply those commands:

git add /path/to/index.php

git commit --amend

but i have this result :

/path/index.php:7: trailing whitespace.

/path/index.php:52: trailing whitespace.

/path/index.php:62: trailing whitespace.

/path/index.php:81: trailing whitespace.

What i want is to commit ignoring those whitespaces that are existing from the beginning in this file , i don't want to remove them.

Forcing the commit to ignore those whitespaces

I hope that any one have a solution for this issue.Thank you for your Help

3 Answers 3

4

Use the --no-verify option. Somebody did bother to write the custom code that's refusing things that look like what you're committing, you sure you want to this?

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your response , i just execute git commit --amend --no-verify and it works fine
0

I don't think you can turn off the warnings/errors with git.

Have a look at this answer for reason.

Why does git care about trailing whitespace in my files?

Why do you not want to remove them? Keeping them around can mess up future patches.

Comments

0

I don't think there's any way to ignore whitespace in git, nor should there be - whitespace is data and git tracks changes to data, not code.

But what you can do, is suppress showing whitespace in your diffs with git diff -w (and with a github diff by adding the url parameter ?w=)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.