Reputation: 5101
I am trying to have the diff
between my local repo with git repo
but I am getting error instead of getting difference.
here is the command i run : git diff origin/color-palette/start.txt start.txt
basically i am trying to get the different between both start.txt
file here.
the error i am getting is :
PS C:\Tutorials\try\color-palette> git diff origin/color-palette/start.txt start
.txt
fatal: ambiguous argument 'origin/color-palette/start.txt': unknown revision or
path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
PS C:\Tutorials\try\color-palette>
What is wrong here? and how to exactly get diff between local and remote?
Upvotes: 1
Views: 408
Reputation: 1324447
The syntax for git diff
is:
git diff remotename/branchname:remote/path/afile.txt local/path/afile.txt
The second local/path/afile.txt
is a shortcut for HEAD:local/path/afile.txt
In your case:
git diff origin:start.txt start.txt
No need for color-palette
here, since it might be the root folder of your local repo.
Not that if you are comparing with a remote, it is generally a good idea to update the local image of that remote in your repo first:
git fetch
Then you can do a git diff
, which works with what is in your local .git/remotes/origin
: it won't make an actual query to the remote repo.
Upvotes: 1