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,557
  • 16
  • 54
  • 68

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
  • 448,244
  • 59
  • 642
  • 775
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250