git checkout 특정 파일

git checkout 특정 파일

달리던 그 순간 git status나는

modified:   loanwolf/alerts/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/alerts/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/clientspace/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/clientspace/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/configurations/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/configurations/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/contracts/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/contracts/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/contrib/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/contrib/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/core/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/core/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/core/templatetags/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/core/templatetags/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/customers/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/customers/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/customers/models.py
modified:   loanwolf/dashboard/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/dashboard/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/documents/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/documents/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/employees/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/employees/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/equifax_report/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/equifax_report/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/loans/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/loans/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/messaging/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/messaging/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/notes/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/notes/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/operations/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/operations/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/perception/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/perception/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/products/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/products/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/requests/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/requests/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/requests/models.py
modified:   loanwolf/statistics/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/statistics/locale/fr/LC_MESSAGES/django.po
modified:   loanwolf/users/locale/fr/LC_MESSAGES/django.mo
modified:   loanwolf/users/locale/fr/LC_MESSAGES/django.po

삭제할 출력 modified:과 파일을 정리하고 싶습니다.

loanwolf/requests/models.py
loanwolf/customers/models.py
loanwolf/requests/locale/fr/LC_MESSAGES/django.po

사실 저는 마지막 세 개의 파일을 제외한 모든 파일을 유지하고 싶습니다. 어떻게 해야 하나요?

지금은 할 수 있을 것 같아요 git status | grep -v 'request'. git checkout이 세 파일을 제외한 모든 파일을 원합니다 .

git status | grep 'modified:' | awk '{print $2}' | xargs git [diff|add|checkout]????

답변1

나는 이것을 다음과 같이 처리할 것이다:

  • (임시로) 보관하고 싶은 파일 제출

    git commit -m WIP loanwolf/requests/models.py loanwolf/customers/models.py loanwolf/requests/locale/fr/LC_MESSAGES/django.po
    
  • 다른 모든 것을 확인하세요

    git checkout .
    
  • 커밋을 취소하려면 재설정하세요. (이렇게 하면 변경 사항이 손실되지 않습니다.)

    git reset HEAD^1
    

정말로 시도해보고 싶다면 git status확인해 보세요 git status -s. 출력이 안정적으로 처리되기가 더 쉽습니다.

관련 정보