Sample Header Ad - 728x90

git show does not understand relative file names

1 vote
1 answer
687 views
I am using git to version control config files on my system. I have git root at the root of my filesystem /, and I control /etc and /root. When I am in /root and do: git log .zshrc, it shows me commit history. I want to display the contents of .zshrc for particular commit: # git show a100e3515779a900509b52230d449a6446fa110b:.zshrc fatal: Path 'root/.zshrc' exists, but not '.zshrc'. Did you mean 'a100e3515779a900509b52230d449a6446fa110b:root/.zshrc' aka 'a100e3515779a900509b52230d449a6446fa110b:./.zshrc'? # git show a100e3515779a900509b52230d449a6446fa110b:/root/.zshrc fatal: Path '/root/.zshrc' exists on disk, but not in # git show a100e3515779a900509b52230d449a6446fa110b:root/.zshrc # git show a100e3515779a900509b52230d449a6446fa110b:./.zshrc only the last 2 commands works. Why do .zshrc and /root/.zshrc not work, and why do I have to use the least convenient notation such as ./.zshrc ? Is there some configuration option that I can change, so that git understands .zshrc and /root/.zshrc ?
Asked by Martin Vegter (598 rep)
Jul 28, 2022, 06:55 AM
Last activity: Aug 5, 2022, 07:48 AM