0

I just started using git and noticed that sometimes there would be a piece of kind of random text after the @@ -100,3 +100,4 @@. I believe that piece of text acts as a comment in a diff file, but I don't understand how this happened. Below is the output of git diff after I removed an empty line from my file:

diff --git a/init.el b/init.el
index 95ae69b..7c1d279 100755
--- a/init.el
+++ b/init.el
@@ -601,4 +601,3 @@ for example. 20201010103030.txt"
   :diminish abbrev-mode)

 (use-package htmlize) ; for exporting org agenda to html
-

As you can see there's for example. 20201010103030.txt in there in this case. And this particular string is from the comment I wrote for one of my functions.
There would be other things some other times.
Can anyone explain what this is?

SparedWhisle
  • 1,370
  • 2
  • 10
  • 20
  • Just found a very good answer on this topic over here: https://stackoverflow.com/questions/28111035/where-does-the-excerpt-in-the-git-diff-hunk-header-come-from – SparedWhisle Jun 28 '20 at 14:40

1 Answers1

1

Using this git tries to help you to see where a change was made by generating this tiny string.

Though this might or might not be there at all.

In this case for example it might say 'for example' because that is what was changed, but when more is changed this text might disappear or git might find a clearer way of describing the change (like 'class XXX' if something got changed throughout some class, or nothing at all if it doesn't know). This is just git doing its best to be helpful.

Koen
  • 174
  • 1
  • 10