From 458b71d8b7c31e0672c9ede5967330dd6f843fd5 Mon Sep 17 00:00:00 2001 From: Adam Jurkiewicz Pythonista Local Date: Wed, 10 Dec 2025 18:21:12 +0100 Subject: [PATCH] added git desc --- polecenia/04_reset.txt | 8 ++++++++ polecenia/05_revert.txt | 8 ++++++++ polecenia/06_rebase.txt | 9 +++++++++ 3 files changed, 25 insertions(+) create mode 100644 polecenia/04_reset.txt create mode 100644 polecenia/05_revert.txt create mode 100644 polecenia/06_rebase.txt diff --git a/polecenia/04_reset.txt b/polecenia/04_reset.txt new file mode 100644 index 0000000..d7371d7 --- /dev/null +++ b/polecenia/04_reset.txt @@ -0,0 +1,8 @@ +git reset +Przesuwa wskaźnik gałęzi (HEAD) do wybranego commitu, usuwając lub zachowując zmiany w zależności od opcji (--soft, --mixed, --hard). Zmienia historię i nadpisuje commity, więc używaj ostrożnie na współdzielonych branchach. + +Przykład w Bash (cofnij ostatni commit, zachowując zmiany w stagingu): +git reset --soft HEAD~1 + +Przykład (hard reset - usuń wszystko po commitcie): +git reset --hard HEAD~2 diff --git a/polecenia/05_revert.txt b/polecenia/05_revert.txt new file mode 100644 index 0000000..9b5030c --- /dev/null +++ b/polecenia/05_revert.txt @@ -0,0 +1,8 @@ +git revert +Tworzy nowy commit, który cofa zmiany z wybranego commitu, zachowując pełną historię. Bezpieczne dla współdzielonych branchów, bo nie usuwa commitów. + +Przykład (cofnij ostatni commit): +git revert HEAD + +Przykład (cofnij zakres commitów): +git revert HEAD~2..HEAD diff --git a/polecenia/06_rebase.txt b/polecenia/06_rebase.txt new file mode 100644 index 0000000..444978d --- /dev/null +++ b/polecenia/06_rebase.txt @@ -0,0 +1,9 @@ +git rebase +Przenosi commity z bieżącej gałęzi na inną bazę, liniaryzując historię (usuwa merge commity). Zmienia historię, idealne do czyszczenia feature brancha przed merge. + +Przykład (rebase na master): +git checkout feature +git rebase master + +Przykład (interaktywny rebase - edytuj ostatnie 3 commity): +git rebase -i HEAD~3