ProgramingTip

추적되지 않은 파일을 제거하도록 git에게 알립니다.

bestdevel 2020. 12. 11. 19:13
반응형

추적되지 않은 파일을 제거하도록 git에게 알립니다.


가능성 :
git 작업 복사본에서 추적되지 않은 파일을 어떻게 제거합니까?

git에게 untrack 파일을 제거하도록 지시 할 수 있습니까? 주로 인기있는 것입니까?

예 :

git checkout -- index.php <-- revert my file
git checkout -- master <-- this would revert the entire repo back to the last commit on master, removing (deleting) any and all untracked files as well as reverting committed ones.

나는 이것이 쉘에서 사소한 할 일이라는 것을 알고 있다는 것을 Git에서 할 수 있는지 알고 싶습니다.


를 찾고 있습니다 git clean. 추적되지 않은 모든 파일이 삭제됩니다. 기본적으로 이것은 무시되지 않습니다. .gitignore하지만 git clean -x해당 파일도 정리합니다.

로부터 git clean매뉴얼 페이지

   -x
       Don't use the ignore rules. This allows removing all untracked
       files, including build products. This can be used (possibly in
       conjunction with git reset) to create a pristine working directory
       to test a clean build.

필요한 경우 디렉토리에있는 파일을 현재 위치에서 제거 할 git clean항목 -df추가 해야합니다 . x된 파일을 무시 포함하려면 추가 합니다.

따라서 소스 제어에있는 그대로 남기고 작업을 정리 한 다음 명령을 실행하십시오.

git clean -xdf

참고 URL : https://stackoverflow.com/questions/7588268/telling-git-its-ok-to-remove-untracked-files

반응형