0

In my git repository I have 2 files committed, one is a symbolic link and another is a regular file

$ ls -l
-rw-r--r--. 1 user group 4 Mar 13 00:43 a
lrwxrwxrwx. 1 user group 4 Mar 13 00:43 b -> file
$ cat a
file$ 
$ hexdump -C a
00000000  66 69 6c 65                                       |file|
00000004
$ 

I can use git show HEAD:a and git show HEAD:b to view the content of these files, and the result are the same

$ git show HEAD:a
file
$ git show HEAD:b
file
$ git show HEAD:a | hexdump -C
00000000  66 69 6c 65                                       |file|
00000004
$ git show HEAD:b | hexdump -C
00000000  66 69 6c 65                                       |file|
00000004
$ git show HEAD:
tree HEAD:

a
b
$ 

Is there a way to for git show to display the type of the file? Or are there other commands to distinguish between symbolic links and regular files?

Eric Stdlib
  • 1,292
  • 1
  • 18
  • 32
  • Related: https://stackoverflow.com/questions/954560/how-does-git-handle-symbolic-links – 1615903 Mar 13 '23 at 04:55
  • 1
    Based on that, symlinks should have file mode `120000` instead of something like `100644`. I'm not sure if `git show` has some parameter that would make it show the file mode. – 1615903 Mar 13 '23 at 04:58

0 Answers0