I øyeblikket, når jeg kjører git status
, fikk jeg
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
Jeg vil rense utgangen for å fjerne modified:
og filene
loanwolf/requests/models.py loanwolf/customers/models.py loanwolf/requests/locale/fr/LC_MESSAGES/django.po
Jeg vil faktisk beholde all filen, bortsett fra de tre siste. Hvordan kunne jeg gjøre det?
For øyeblikket tror jeg jeg kunne gjøre git status | grep -v "request"
. Jeg vil git checkout
alle filer bortsett fra de tre filene.
git status | grep "modified:" | awk "{print $2}" | xargs git [diff|add|checkout]
????
Kommentarer
- Hvordan plukker du ut de tre filene ??
- stackoverflow.com / spørsmål / 38328065 / … … Jeg antar at vi kunne gjøre det.
Svar
Jeg vil gjøre det på denne måten:
-
forplikt filene du vil beholde (midlertidig)
git commit -m WIP loanwolf/requests/models.py loanwolf/customers/models.py loanwolf/requests/locale/fr/LC_MESSAGES/django.po
-
sjekk alt annet
git checkout .
-
reset å angre forpliktelsen (dette mister ingen endringer)
git reset HEAD^1
Hvis du vil leke med git status
, sjekk ut git status -s
, utgangen er lettere å behandle pålitelig.
Kommentarer
- Du kan sannsynligvis også bruke en " stash "? Jeg ' har gjort det selv, men bare en eller to ganger med en GUI. Det betyr i utgangspunktet at du ' lagrer noen filer bort en stund, så trekker du de siste forpliktelsene, og deretter bruker du de lagrede filene i depotet.
- @Kusalananda en stash ville være mer praktisk, men
git stash
lagrer hele arbeidsområdet, det kan ikke filtreres (AFAIK). Du har rett i at bruken av en forpliktelse her er mer lik en stash enn en riktig forpliktelse. Noen GUI-er har stash-varianter som støtter filtrering, de vil også fungere.