Development Tip

TFS에서 특정 파일의 체크인을 항상 차단하려면 어떻게해야합니까?

yourdevel 2020. 11. 14. 11:10
반응형

TFS에서 특정 파일의 체크인을 항상 차단하려면 어떻게해야합니까?


내가 항상 변경 한 파일이 하나 있지만 체크인을 원하지는 않습니다. TFS에서 내가 파일을 체크인하거나 변경 사항을 커밋하지 못하도록 차단하고 싶습니다. 이를 위해 TFS를 어떻게 구성 할 수 있습니까?

세부 정보 : 로컬 컴퓨터에서 주석 처리를 선호하는 일부 잘못된 코드를 체크인 한 프로젝트의 다른 개발자가 있습니다. 그들이 클라이언트이기 때문에 나는 이것을 정치적으로 만들기보다는 기술적 운동으로 유지하는 것을 선호합니다.


TFS 저평가 된 기능 중 하나는 클로킹 입니다. SVN과 마찬가지로 ignore클로킹을 사용하면 특정 폴더 또는 파일을 무시할 수 있습니다.

폴더 숨기기

폴더를 숨기는 것은 쉽습니다. 소스 제어 탐색기에서 폴더를 마우스 오른쪽 버튼으로 클릭하고 Cloak

파일 클로킹

UI는 단일 파일에 클로킹을 노출하지 않지만 때때로 .NET과 같은 특정 파일을 클로킹하고 싶을 수 있습니다 app.config.

  1. 로 이동 File> Source Control>Workspaces

  2. 작업 공간을 선택하고을 클릭 Edit합니다.

  3. 작업 폴더 아래에 상태가있는 새 항목과 Cloaked숨길 파일의 전체 서버 경로를 입력합니다. (예 : $/MyTeamProject/Dev/Src/SomeProject/app.config)

파일 클로킹


로컬 작업 영역 .tfignore 파일 사용 (TFS 2012, 2013, 2015 이상)

에서 현지 작업 공간 , 당신이 사용할 수있는 사용 .tfignore파일 (에 해당 .gitignore힘내를 들어)

.tfignore file example
 ######################################
# Ignore .cpp files in the ProjA sub-folder and all its subfolders
ProjA\*.cpp
# 
# Ignore .txt files in this folder 
\*.txt
#
# Ignore .xml files in this folder and all its sub-folders
*.xml
#
# Ignore all files in the Temp sub-folder
\Temp
#
# Do not ignore .dll files in this folder nor in any of its sub-folders
!*.dll

권한에 의한 차단

또 다른 방법은 파일에 대한 체크인을 거부하는 것입니다 (관리자 권한 필요).

  1. 파일을 마우스 오른쪽 버튼으로 클릭> 클릭 Properties>Security

  2. 사용자를 추가 Deny하고 Check In권한에 표시 하십시오 .

체크인 거부


TFS 2012의 경우 .tfignore 파일을 사용 하십시오.

로컬 작업 영역에 매핑 된 폴더에 무시 된 파일을 추가하면 팀 탐색기의 보류중인 변경 사항 페이지에 나타나지 않습니다.

http://msdn.microsoft.com/en-us/library/ms245454.aspx


Visual Studio 2013 (및 2012)

이 기능은 파일을 선택하고 다음으로 이동하여 사용할 수 있습니다.

File > Source Control > Advanced > Exclude ... from Source Control

소스 제어에서 파일을 제외 할 수 있습니다.

1. 솔루션 탐색기에서 파일 선택

2. 파일-> 소스 제어-> 고급으로 이동합니다.

제외 할 경로

그리고 여기 있습니다

다음은 제외입니다.


두 가지 방법이 있습니다.

  1. "보류중인 변경 사항"창에서 "선택 취소"할 수 있으며 다음에 Visual Studio를로드 할 때이를 기억해야합니다. "모두 선택"하고 목록의 항목을 선택 / 선택 취소하고 오류가 발생하기 쉬운 경우 약간 번거 롭습니다.
  2. Don't "check-out" the file, go into Explorer and remove the Read-Only attribute yourself. Then edit the bits you want. The caveat is, that TFS doesn't know about it and doesn't always update the file correctly. Also, if you edit that file in VS (for anoter change), it will be "checked out" and you may then check it in by mistake.

I don't like either option in TFS / VS 2010, so I actually avoided doing this (I used to have a large "ignore-on-commit" when we used SVN). Now I am using VS11 Beta, the Excluded list does exactly what I want, I move something to it and it stays there, and I can easily put other changes on and off that list and not checkin that file.


Another option is using a custom check-in-policy. You can build your own or use Forbidden Patterns Policy from the TFS 2010 Power Tools. Of course you would need to be an TFS admin to install it and it might not be the thing you want in your situation. Also any check-in-policies can be overridden.


if you are using "Local" workspace type, that is new to TFS 2012 - your source-controlled files are not set "read-only" at all. But in this case no matter where you edit them, they are seen by TFS as changed and included into pending changes. Would be great to have option like "auto-exclude" from pending changes by default. And include them only when you want this.


숨겨진 폴더는 VS2010을 사용하는 경우 TFS에서 변경 사항으로 감지되지 않습니다. TFS의 일부가되지 않을 폴더는 숨김으로 표시합니다.

참고 URL : https://stackoverflow.com/questions/9741975/how-can-i-always-block-checkin-of-a-specific-file-in-tfs

반응형