I have a problem which was described in post 'git status' shows changed files, but 'git diff' doesn't.. My current state is the following:
wakatana@ubuntu:~/magic_repo$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: 1.txt
new file: 3.txt
# get content of file in working area
wakatana@ubuntu:~/magic_repo$ cat 1.txt
22
# get content of file in staging area
wakatana@ubuntu:~/magic_repo$ git show :1.txt
22
# diff file in working area and staging area
wakatana@ubuntu:~/magic_repo$ git diff 1.txt
wakatana@ubuntu:~/magic_repo$
As you can see both files in working area and staging has the same content. Based on mentioned thread I've created patch which shows the differences. If I understand it correctly it shows that that the file is different because of its content not because of its file mode (which is common case of this problem).
wakatana@ubuntu:~/magic_repo$ git format-patch HEAD^
0001-1.txt-changed-2.txt-remains-the-same.patch
wakatana@ubuntu:~/magic_repo$ cat 0001-1.txt-changed-2.txt-remains-the-same.patch
From f26c665bc9ffd5b704040656f7ecb17db85ccbf6 Mon Sep 17 00:00:00 2001
From: wakatana <my_secret_email@secret.com>
Date: Thu, 14 Jul 2022 17:07:15 +0200
Subject: [PATCH] 1.txt changed, 2.txt remains the same
---
1.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/1.txt b/1.txt
index d00491f..b4de394 100644
--- a/1.txt
+++ b/1.txt
@@ -1 +1 @@
-1
+11
--
2.25.1
My question is: How did I get into this state, and why? I mean what command sequence I have to issue in new repo to get same results as I've described above? Is it some git weird behavior or just my misunderstanding of how GIT works?