Languages
[Edit]
PL

Git stały reset z usunięciem nieśledzonych plików

3 points
Created by:
Sylwia
3500

1. Git reset hard usuwa wszystkie nieśledzone pliki i katalogi.

git reset --hard HEAD && git clean -fd

To polecenie cmd zresetuje naszą gałąź i usunie wszystkie nieśledzone pliki i katalogi. Wszystkie niezatwierdzone zmiany zostaną usunięte i mamy czysty stan gałęzi. Bardzo potężne polecenie, zanim go użyjesz, pomyśl dwa razy.

Praktyczny przykład niektórych plików tymczasowych:

2. Wyjaśnienie resetowania git --hard HEAD

$ git reset --hard HEAD

 

Git pozostawi niezatwierdzone pliki.

3. Wyjaśnienie git clean -fd

Git clean najbardziej przydatne flagi:

-n, --dry-run         dry run
-f, --force           force
-d                    remove whole directories

 

git clean -help całe wyjście:

$ git clean -help
usage: git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>...

    -q, --quiet           do not print names of files removed
    -n, --dry-run         dry run
    -f, --force           force
    -i, --interactive     interactive cleaning
    -d                    remove whole directories
    -e, --exclude <pattern>
                          add <pattern> to ignore rules
    -x                    remove ignored files, too
    -X                    remove only ignored files

4. Wyjaśnienie git clean --dry-run

$ git clean --dry-run

 

To polecenie wyświetli listę elementów, które zostaną usunięte. Warto go uruchomić przed uruchomieniem git clean -fd.

5. Bibliografia

  1. git reset - Docs
  2. git clean - Docs
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join