12345
12345

Reputation: 299

Find the file differences between two repositories

I was wondering if it is possible to see individual file differences between a file (hello.txt) in my local repo and another repo of a different developer (on the same server)?

I know I could do a git pull and get the file changes, but is there an alternative way of avoiding over-writing my file?

Upvotes: 0

Views: 191

Answers (1)

cdhowie
cdhowie

Reputation: 169488

If you do not have the commit you want to compare to locally, then git fetch first. This will fetch new commit objects from the remote repository, but will not change your HEAD or working tree.

Once you do have the commit, just do this:

git diff OTHERCOMMIT -- hello.txt

Where OTHERCOMMIT is the commit identifier (branch name, hash, etc.) for the commit you want to compare your local working copy of hello.txt against.

Upvotes: 1

Related Questions