question

TezinoAngelique-7964 avatar image
0 Votes"
TezinoAngelique-7964 asked PalanisamyThangavel-1330 commented

How do I lock files in a Git repository to prevent others from working on the same file?

Hello,

I'm very new to Azure DevOps, and I've used TFS for version control in the past for our .rdl files. Now we are using Git in Azure DevOps for source control. I have a repository with several files that will be used by more than one developer. We work on files that are assigned to us, but every now and then one Developer might work on a file that belongs to another Developer. I know TFS will lock files to prevent overlap, but how do we lock files using Git to prevent another developer from working on the same file? Any help is much appreciated.

sql-server-reporting-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cooldadtx avatar image
0 Votes"
cooldadtx answered

You can't. That is exactly what Git is all about. It is designed to allow multiple people to be working on any # of files at the same time. There is no "lock" concept. When a user attempts to push a change to a file that was changed after they had pulled it then they get a merge conflict and have to merge their changes with the changes on the server. This is a far better approach than the old TFVC system in which a user might check out a file and leave it checked out even if they never touch it and/or the changes they make aren't conflicting with changes made by someone else in the same file.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Joyzhao-MSFT avatar image
0 Votes"
Joyzhao-MSFT answered PalanisamyThangavel-1330 commented

Hi @TezinoAngelique-7964 ,
Unfortunately you cannot use Git to lock files to prevent other developers from working on the same file.
If you are using git LFS (which is supported by some git hosting providers, like GitHub、GitLab) you could use File Locking.
Best Regards,
Joy


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Git LFS will support azure repo where we hosted our source code?

0 Votes 0 ·