Aggiungi 'docs/02-clone-e-struttura-repo.md'
This commit is contained in:
@@ -0,0 +1,86 @@
|
|||||||
|
|
||||||
|
<!-- File: 02-clone-e-struttura-repo.md -->
|
||||||
|
|
||||||
|
# Clonare il repository e primi comandi
|
||||||
|
|
||||||
|
## Clonare un repository
|
||||||
|
|
||||||
|
Come `svn checkout`, ma con Git:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://git.meridiana.it/progetto/repo.git
|
||||||
|
cd repo
|
||||||
|
````
|
||||||
|
|
||||||
|
Questo crea una cartella `repo` con:
|
||||||
|
|
||||||
|
* una copia completa della storia
|
||||||
|
* un **remote** chiamato `origin` che punta al server
|
||||||
|
|
||||||
|
Puoi vedere i remote configurati:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git remote -v
|
||||||
|
```
|
||||||
|
|
||||||
|
Esempio di output:
|
||||||
|
|
||||||
|
```text
|
||||||
|
origin https://git.meridiana.it/progetto/repo.git (fetch)
|
||||||
|
origin https://git.meridiana.it/progetto/repo.git (push)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Stato del repository
|
||||||
|
|
||||||
|
Per vedere cosa è cambiato rispetto all’ultimo commit:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git status
|
||||||
|
```
|
||||||
|
|
||||||
|
Esempio:
|
||||||
|
|
||||||
|
```text
|
||||||
|
On branch develop
|
||||||
|
Your branch is up to date with 'origin/develop'.
|
||||||
|
|
||||||
|
Changes not staged for commit:
|
||||||
|
modified: src/main.py
|
||||||
|
|
||||||
|
Untracked files:
|
||||||
|
docs/nuovo-documento.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## Vedere la storia dei commit
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git log
|
||||||
|
```
|
||||||
|
|
||||||
|
Versione compatta:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git log --oneline --graph --decorate --all
|
||||||
|
```
|
||||||
|
|
||||||
|
Esempio:
|
||||||
|
|
||||||
|
```text
|
||||||
|
* a1b2c3d (HEAD -> develop, origin/develop) Fix bug nel calcolo totale
|
||||||
|
* 9f8e7d6 Aggiunge endpoint /health
|
||||||
|
* 1a2b3c4 Inizializza progetto
|
||||||
|
```
|
||||||
|
|
||||||
|
## Confrontare differenze
|
||||||
|
|
||||||
|
Differenze rispetto all’ultimo commit:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git diff
|
||||||
|
```
|
||||||
|
|
||||||
|
Differenze per un singolo file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git diff path/al/file.ext
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user