Git intermedio
George Boorman
Curriculum Manager, DataCamp
| Command | Function |
|---|---|
git diff |
Mostra le differenze tra tutti i file non in stage e l'ultimo commit |
git diff report.md |
Mostra le differenze tra un file non in stage e l'ultimo commit |
git diff --staged |
Mostra le differenze tra tutti i file in stage e l'ultimo commit |
git diff --staged report.md |
Mostra le differenze tra un file in stage e l'ultimo commit |
git diff 35f4b4d 186398f |
Mostra le differenze tra due commit usando gli hash |
git diff HEAD~1 HEAD~2 |
Mostra le differenze tra due commit usando HEAD invece degli hash |
git diff main summary-statistics


spazio per scorrere e q per usciregit branch
main
* feature_dev
feature_dev
Serve un altro branch per una seconda feature in sviluppo
Soluzione: rinominare feature_dev
Rinomina di un branch
git branch -m
git branch
main
* feature_dev
feature_dev
Serve un altro branch per una seconda feature in sviluppo
Soluzione: rinominare feature_dev
git branch -m feature_dev chatbot
git branch
main
* chatbot
I progetti grandi possono avere molti branch
Elimina i branch quando hai finito
Elimina il branch chatbot con il flag -d
git branch -d chatbot
Deleted branch chatbot (was 3edb989).
chatbot non è stato unito in main, git branch -d chatbot darà erroreerror: The branch 'chatbot' is not fully merged.
If you are sure you want to delete it, run 'git branch -D chatbot'.
-Dgit branch -D chatbot
Deleted branch chatbot (was 3edb989).
Recuperare branch eliminati è difficile, ma non impossibile
Assicurati che non serva più prima di eliminarlo!
| Command | Function |
|---|---|
git diff main chatbot |
Confronta lo stato dei branch main e chatbot |
git branch |
Elenca tutti i branch |
git branch -m old_name new_name |
Rinomina il branch old_name in new_name |
git branch -d chatbot |
Elimina il branch chatbot già unito |
git branch -D chatbot |
Elimina il branch chatbot non ancora unito |
Git intermedio