How do i disable editing files in VS RRS feed

  • Question

  • Hi

    I want to disable editing of files that are already committed in visual studio. Is there a way to disable editing.

    Need behind this is to ensure that my team does not edit any code that are committed and tested. If any edits needed, they will need permission

    Thursday, November 26, 2020 7:59 AM

All replies

  • You cannot limit this directly in Visual Studio. You have to do it in the source code control system on which you are committing your code.

    If you are using (for instance) git on TFS, then you go to TFS and change the properties of your repository. One typical way of doing this is that you don't allow direct push to the master branch. Instead, the developers make their changes to a feature branch (which can be committed without trouble because it is a separate branch), and when they are ready to merge the changes into master they have to send a pull request, and the pull request has to be approved by someone with the permission to do so.

    Thursday, November 26, 2020 9:09 AM
  • Actually setting a file as "read only" in file attribute is enough to make Visual Studio think the file is locked by Source Control - even if there is no Source Control employed for current folder.

    SourceSafe/TFS does that by default. For Git/Svn you'll want to consult their settings file for how.

    Thursday, November 26, 2020 9:26 AM
  • Hi rjax87,
    You question is mostly related to Visual Studio, so I suggest you ask the question on the Microsoft Q&A forum and you can get more professional answer.
    This Visual C# forum mainly discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.
    Best Regards,
    Daniel Zhang

    "Visual c#" forum will be migrating to a new home on Microsoft Q&A ! We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A ! For more information, please refer to the sticky post.

    Friday, November 27, 2020 5:28 AM
  • When I add a new file into a web project in VS 2013, it is immediately "checked in" to git; the file is immediately saved and then the "check in" icon appears to the left of the file. If I make a change to an existing file, the moment I save the file it "checks in". Please note that the source git repository is not modified, but I think my local repository is being checked into.
    Sunday, November 29, 2020 5:22 AM
  • Yes, when you add a new file to Visual Studio or you make a change, this is immediately "checked in" to git. But note that it is checked in to your local working branch (you created a branch before starting making changes, didn't you?). These changes are completely private and will not affect any other branch or user until you decide to merge them, which is a separate operation that you have to initiate explicitly whenever you want it done. You can always merge into other branches in your local disk, but the central source repository can be configured so that you are not allowed to merge directly there, but rather you need to send a pull request that someone else has to approve. This would solve the issue asked by the original poster, who didn't want anyone in the team changing the already-tested committed code.
    Sunday, November 29, 2020 9:42 AM