I have some problem with git diff on ubuntu in vs code.
I have prepared some project and devcontainer for it.
The container was build based on python3.11-apline.
When I open the project in normal terminal – i can see all difs in red and green colors. As expected.
In vs code – im opening the project in devcontainer. the git diff or git diff –color – shows all diffs but not highlighted as red or green.
For test I have saved diffs to file and then opened in the same terminal.
git diff --color > foo.txt
cat foo.txt
And all colors appeared!
I have also tried different vscode themes. All the same.
Do you have any idea?
2
Answers
Finally I have found a solution.
Installing less package resolves the problem:
apk --update add less
in running container or just add the less to the Dockerfile:Run
git config color.diff
in the DevContainer terminal. If it returns auto or always, colors should be enabled. If not, you can enable colors by runninggit config --global color.diff auto
.