masoud ramezani
masoud ramezani

Reputation: 22920

Is there any way to configure git to lock a file when a user work on it?

In TFS, when a user work on a class, other user can't work on it. Is there any configuration for git to do like this work or not?

Upvotes: 1

Views: 147

Answers (3)

Sawan
Sawan

Reputation: 23

Having said all that,

Gitolite is an extension that will let you impose fine grained access control on your repos and files.

Upvotes: 0

Bijendra
Bijendra

Reputation: 10025

No, that's totally Git, that's why for better pratices we should do frequent commits and take pulls to update our repository.

Any conflicts while merging the code should be resolved after checking for previous commits on same line of code and needs a communication.

Upvotes: 1

Greg Hewgill
Greg Hewgill

Reputation: 993223

No. Such a feature would go entirely against the distributed principle of Git.

In my experience, if you have two people working on the same file then one of two things will happen when you go to merge:

  1. There are no merge conflicts because you have been working on separate areas of the code. Carry on. This is the usual case.
  2. There are merge conflicts, and you must resolve them manually. Communication between the two committers is usually essential.

Upvotes: 8

Related Questions