删除文件和单词

删除文件和单词

在我跑步的那一刻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 status | awk '{print $2}' | fgrep -v -f list_to_remove

list_to_remove内容为:

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

相关内容