1

Is there a way to checkout a file in git and not allow anyone else to make changes to it until it is checked back in by the user that checked it out? I.e. Checking out in the true sense of the words.

Thx!

Zoe
  • 27,060
  • 21
  • 118
  • 148
dhalia
  • 401
  • 5
  • 21
  • Indeed there is not. – Tavian Barnes Mar 26 '15 at 22:28
  • See also: [Is there a way to lock individual files or directories on fork when using github?](http://stackoverflow.com/questions/13662255/is-there-a-way-to-lock-individual-files-or-directories-on-fork-when-using-github) – sleske Mar 26 '15 at 23:06
  • Also: [Workflow: Using binary document formats in Git without locks (moving from subversion)](http://programmers.stackexchange.com/questions/184435/workflow-using-binary-document-formats-in-git-without-locks-moving-from-subver) – sleske Mar 26 '15 at 23:14

1 Answers1

1

In the context of version control, this is usually called file locking or reserved checkout.

And no, there is no support for file locking in git. File locking is fundamentally incompatible with a distributed version control system (DVCS), because the whole point of a DVCS is that there can be many clones, which can be used independently of each other, and without communication. So in general, file locking is impossible because there is no central authority to manage the locks.

That said, you can layer file locking on top of git's structures. For example, gitolite supports file locking. However, there's no built-in solution.

sleske
  • 81,358
  • 34
  • 189
  • 227