When the file I'm rewriting has the following content:
one
two
four
and I rewrite it to:
one
two
three
four
I expect the git diff
to say that I've added a line with "three", but it says that I've removed everything in the first version and then added everything in the second version.
This is how I'm writing the file:
with open(file_path, 'w') as my_file:
my_file.write(my_text)
What can I do to get the output I expect from git diff
?