I use git gui to select strings for staging for commit. This usually works like a charm. I am aware of the ability to do the same on the command line.
Whenever the file initially does not have a new line at the end of the git file, gui recognizes this and adds a warning message in the editor, as shown in the screenshot.

Problem
The problem that arises due to the lack of a row is that one can no longer create and commit individual rows . When I right-click to select a specific line and select Stage line for commit from the context menu, an error message will appear.
error: fatal: damaged line on line 11.
The problem is not specific to the operating system and can be reconfigured on Windows, MacOSX and Linux. I know that I can avoid the problem if I add a new line to the file and pass this version before continuing on separate lines.
Steps to reproduce the problem
- Initialize a new repository.
- Create a file with three lines of content with the word "Hallo". Do not put a new line at the end of the file.
- Add and commit the file.
- Edit the same file by inserting words between three lines.
- Open git gui and try to make changes line by line.
Request
I wonder if there is some kind of configuration for git that allows me to work around the problem. Some automation, such as a hook that adds the desired new line, will also be fine.
error reporting
I sent an error report to the git mailing list. You can follow and participate in the discussion here .
source share