Reputation: 3196
I have the following scenario:
Current branch is feature/dashboard
.
I have an untracked file, tmp/dashboard_bulk.js
(came from my browser)
I'd like to compare it with a tracked file app/assets/javascripts/audience/dashboard_bulk.js
that's on branch master
(again, not my current branch).
So source file is untracked, and destination file is on a different path in a different branch.
Is there a way to do this?
Upvotes: 4
Views: 507
Reputation: 18547
git diff
doesn't seem to mind if you give it a path that is untracked.
The syntax for pointing to a file on a different branch is branch:path/to/file
.
Putting these two together, the command to do the diff is
git diff \
master:app/assets/javascripts/audience/dashboard_bulk.js \
tmp/dashboard_bulk.js
Upvotes: 3