2025-09-02 07:07:15 +00:00
|
|
|
|
z1
|
2025-09-02 07:32:18 +00:00
|
|
|
|
z2
|
2025-09-02 08:23:33 +00:00
|
|
|
|
Pewnie! Poniżej masz uproszczone instrukcje do tematu **2.2 Podstawy Gita – rejestrowanie zmian w repozytorium**.
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
# 2.2 Rejestrowanie zmian w Git
|
|
|
|
|
|
|
|
|
|
|
|
## Cel
|
|
|
|
|
|
|
|
|
|
|
|
Nauczysz się:
|
|
|
|
|
|
|
|
|
|
|
|
* sprawdzać stan repozytorium,
|
2025-09-02 08:23:33 +00:00
|
|
|
|
* dodawać pliki do poczekalni,
|
|
|
|
|
|
* zatwierdzać zmiany,
|
|
|
|
|
|
* przeglądać różnice.
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
## Słowniczek
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
* **Śledzony** – plik był w ostatnim commicie
|
|
|
|
|
|
* **Nieśledzony** – plik nowy dla Gita
|
|
|
|
|
|
* **Poczekalnia** – lista zmian, które wejdą do najbliższego commita
|
|
|
|
|
|
* **Commit** – zapisana migawka projektu
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
## Najważniejsze polecenia
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
### 1) Sprawdź status
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
git status
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
### 2) Dodaj do poczekalni
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-09-02 08:23:33 +00:00
|
|
|
|
git add nazwa_pliku
|
2025-09-02 07:03:49 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 3) Zobacz różnice
|
|
|
|
|
|
|
|
|
|
|
|
* **Zmiany poza poczekalnią**:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
git diff
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
* **Zmiany w poczekalni**:
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-09-02 08:23:33 +00:00
|
|
|
|
git diff --staged
|
2025-09-02 07:03:49 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
### 4) Zatwierdź zmiany
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-09-02 08:23:33 +00:00
|
|
|
|
git commit -m "Opis zmian"
|
2025-09-02 07:03:49 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
## Prosty workflow
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
1. **Sprawdź status**: `git status`
|
2025-09-02 08:23:33 +00:00
|
|
|
|
2. **Dodaj do poczekalni**: `git add <plik>`
|
|
|
|
|
|
3. **Commit**: `git commit -m "Opis"`
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
## Ćwiczenie (10 min)
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
1. **Utwórz repozytorium**
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
git init git-lesson
|
|
|
|
|
|
cd git-lesson
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
2. **Stwórz i zakomituj plik**
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-09-02 08:23:33 +00:00
|
|
|
|
echo "Witaj Git!" > README.md
|
2025-09-02 07:03:49 +00:00
|
|
|
|
git add README.md
|
2025-09-02 08:23:33 +00:00
|
|
|
|
git commit -m "Dodaj README"
|
2025-09-02 07:03:49 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
3. **Modyfikuj plik**
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-09-02 08:23:33 +00:00
|
|
|
|
echo "Druga linia" >> README.md
|
|
|
|
|
|
git status
|
|
|
|
|
|
git diff
|
|
|
|
|
|
git add README.md
|
|
|
|
|
|
git commit -m "Dodaj drugą linię"
|
2025-09-02 07:03:49 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
2025-09-02 08:23:33 +00:00
|
|
|
|
4. **Sprawdź historię**
|
2025-09-02 07:03:49 +00:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-09-02 08:23:33 +00:00
|
|
|
|
git log --oneline
|
2025-09-02 07:03:49 +00:00
|
|
|
|
```
|
|
|
|
|
|
|