berimbolo berimbolo - 1 month ago 14
Git Question

Git comparison of remote branches

I am very new to git and was trying to use the following command to compare a remote version of a branch with the remote version of develop to show the files which have differences between the two:

git diff origin/develop origin/feature/xxx --name-only


When ran, this command showed different results for 3 different development machines and I dont understand why.

Is this command not actually doing what I think it is doing?

I actually just tried this command whilst not even connected to the remote git server and it still shows me a result when I would have expected to have got some sort of error?

Answer

When ran, this command showed different results for 3 different development machines

It compares against the local version of those remote tracking branches: it depends on when the remote was fetched.

To get the same result (if done on all three machine at the same time), you would need a git fetch first.