2

I'm not the best in terms of programming and using Git, since I do not use it that often, and I have an issue that I wouldn't expect to ever have:

  1. I'm forking to a Git repository
  2. I'm cloning forked repository
  3. Applying changes to code
  4. Pushing changes to Git
  5. Creating pull request

Now, the issue is that the Python code from cloned repository has a newline at the end of the code (as the Python god intended to, I don't know).

Now although I do not remove that newline at the end, when I push the code and create a pull request that newline is being removed ALTHOUGH in pycharm I can see there is a newline at the end of the code O_o

What is wrong? Is it some kind of setup of git? Or rather PyCharm?

enter image description here

I also got this warning after 'git add':

enter image description here

and I thought 'git config core.autocrlf false' would fix the issue, but maybe it was not a correct command.

2 Answers 2

1

CRLF being replaced by LF is not an issue. Both are interpreted as newlines. It is not removing your newline.

Maybe double-check if your file is properly staged and committed with a newline present in it? It's possible that the absence of newline is just a user error.

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

3 Comments

I'm not sure to be honest, but when I experimented like I removed that newline and tried to commit again it said there is nothing new to commit so like it wouldn't even see the difference between a file with a newline and without
try checking the differences in your files with git status and commit using git commit. My guess would be that IDE's like to be smart and ignore your 'foolish end-of-file newline additions'? git status should definitely reflect any added newlines at the end of file.
when I'm comparing local history in IDE it shows nothing suspicious. If I remove newline it shows no newline, if I add newline it shows that newline. After i push it removes the newline though
1

Allright, I did some experiments and it turns out, that it does push with a newline BUT when I check this commit in github.com it doesn't show a newline there (it's removed). BUT when I pull that repository after it was commited, the file itself contains a newline.

Seems some kind of github display error? : /

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.