1

We are using git lfs lock (GitHub's open source git extension) to prevent conflicts with binary files. The problem is that sometimes people forget to pull the latest version of a file, they lock the file and work on it but get rejected when trying to push.

So how can I quickly check if I have the latest version of the file, before locking it?

Roberto
  • 11,011
  • 15
  • 53
  • 66

1 Answers1

3

You can:

That is:

git fetch
if git diff --quiet origin/master -- yourFile; then
   echo "No changes"
else 
   echo "File changed, let's reject log"
fi
torek
  • 389,216
  • 48
  • 524
  • 664
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755