Python script that does a git diff
if result is False:
    raise Exception('diff found between the files')
else:
    return 'files are identical'


Why would a difference be considered Exceptional? Given that nothing else happens in the program, there isn't much difference at this point between raising an error and just printing the message, but it seems like an odd way to do things.

Also, you shouldn't test for False by identity, if not result is the usual method.



Have you considered allowing the user to select branches to compare? You could use the current value as a default, e.g. 

 def diff_versions(file_to_be_compared, directory, branch="origin/master"):