Reputation: 879
First of all, I am a novice in english, so excuse me if there are mistakes.
Today I pushed my script to my remote repository in Gitlab.
When I checked my code in gitlab, I saw "\ No newline at end of file" in the middle of the script and not as usual at the end of the page.
What is it about ?
How can I solve this problem?
Here is a screenshot below :
Upvotes: 0
Views: 1007
Reputation: 181745
The \ No newline at end of file
relates to the line directly above it, - Disallow: /preload*
. This is marked with -
and in red, meaning it was "deleted". The "no newline" message indicates that this was the last line in the file before this change, and that it wasn't properly terminated with a newline character.
But as you can see in the next line, it shows + Disallow: /preload*
in green, meaning it was "added". This time with a trailing newline, because it's not followed by a \ No newline at end of file
warning.
In short, what this diff is trying to tell you is that a newline was added at the end of line 9. There might be more lines after that (it's not visible in your screenshot) but those would all be newly added as well.
Not having a newline at the end of a file is a bad habit, but rarely causes problems; see What's the point in adding a new line to the end of a file? and Why should text files end with a newline? if you want to know more.
Upvotes: 1