Forethinker
Forethinker

Reputation: 3758

git command to compare current working directory and another commit

I have a modified file on my current working directory called file.txt. I want to compare it with a version of it on debug branch. The following command does not work:

git diff file.txt debug:file.txt

fatal: Path 'file.txt' exists on disk, but not in 'debug'

How can I compare them? Do I have to commit first?

Upvotes: 0

Views: 969

Answers (1)

William Seiti Mizuta
William Seiti Mizuta

Reputation: 7985

Use the following command to compare file.txt from current branch to debug branch:

git diff debug file.txt

Upvotes: 2

Related Questions