병합하는 동안 내 자식 저장소에서 .orig 파일을 확인하는 방법이 수정되었으며 추적되지 않은 섹터에 표시됩니다. 그러나 더 이상 내 저장소 에이 파일을 원하지 않습니다. 그렇게하는 방법.
modified: Gemfile.lock.orig
# modified: Gemfile.orig
# modified: app/assets/images/bg_required.png.orig
# modified: app/assets/javascripts/application.js.orig
etc...
도움을 주시면 감사하겠습니다.
답변
이 경우 가장 좋은 해결책은 간단하게 유지하고 git과 독립적으로 해당 파일을 제거하는 것입니다.
cd /your/repo/directory
find . -name '*.orig' -delete
또는 Windows / PowerShell에서 다음 명령을 실행할 수 있습니다.
cd \your\repo\directory
Get-ChildItem -Recurse -Filter '*.orig' | Remove-Item
답변
답변
넌 할 수있어:
git config --global mergetool.keepBackup false
자세한 내용은 Git mergetool이 원치 않는 .orig 파일을 생성 함 을 참조하십시오.
답변
.gitignore를 사용하여 파일을 무시할 수 있습니다
여기에 표시된 것처럼 * .orig를 목록에 넣으십시오.
https://help.github.com/articles/ignoring-files
현재 파일을 삭제하려면 다음과 같이 쉘 스크립트를 작성하고 프로젝트 폴더에서 실행할 수 있습니다
for file in `find *.orig -type f -print`
do
echo "Deleting file $file"
git rm $file -f
done
답변
불행히도 전역 gitignore 파일에 추가 git clean
했기 때문에 작동하지 않으므로 *.orig
깨끗 하지 않습니다 . 심지어 실행은 git clean -x
내가 원하지 않기 때문에 좋지 않습니다 모든 내 무시 파일 삭제하기. git clean -i
도움이 되긴하지만 실제로 모든 파일을 검토하고 싶지는 않습니다.
그러나 제외 패턴을 사용하고 일치를 무효화 할 수 있습니다. 이 명령으로 미리보기 :
git clean -e '!*.orig' --dry-run
그런 다음 확신이있을 때 force
플래그를 전달하여 실제로 삭제하십시오.
git clean -e '!*.orig' -f
leorleor의 의견을 바탕으로
답변
git rm Gemfile.lock.orig
나머지 파일은 필요하지 않습니다.
git commit --amend
해당 얼룩을 완전히 제거하려면
git gc --prune=0 --aggressive
답변
나를 위해 git clean -f
모든 * .oig 파일을 제거했습니다. 그리고 이전에 이미 존재했던 것들을 유지합니다.
이것은 병합 후 (거의) 모습입니다.
$ git status
On branch feature/xyz
Your branch is ahead of 'origin/feature/xyz' by 568 commits.
(use "git push" to publish your local commits)
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/codeStyles/
.idea/misc.xml.orig
.idea/codeStyles/
추적되지 않은 파일로 병합하기 전에 이미있었습니다. .idea/misc.xml.orig
(그리고 훨씬 더) 제거해야했습니다.
=> 사용 git clean -f
:
$ git clean -f
Removing .idea/misc.xml.orig
결과 :
$ git status
On branch feature/xyz
Your branch is ahead of 'origin/feature/xyz' by 568 commits.
(use "git push" to publish your local commits)
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/codeStyles/