Intermediate Git
George Boorman
Curriculum Manager, DataCamp
| Příkaz | Funkce |
|---|---|
git diff |
Zobrazí změny mezi všemi neinscenovanými soubory a posledním commitem |
git diff report.md |
Zobrazí změny mezi neinscenovaným souborem a posledním commitem |
git diff --staged |
Zobrazí změny mezi všemi inscenovanými soubory a posledním commitem |
git diff --staged report.md |
Zobrazí změny mezi inscenovaným souborem a posledním commitem |
git diff 35f4b4d 186398f |
Zobrazí změny mezi dvěma commity pomocí hashů |
git diff HEAD~1 HEAD~2 |
Zobrazí změny mezi dvěma commity pomocí HEAD místo hashů |
git diff main summary-statistics


space, pro ukončení qgit branch
main
* feature_dev
feature_dev
Je potřeba další větev pro druhou novou funkci
Řešení – přejmenovat feature_dev
Přejmenování větve
git branch -m
git branch
main
* feature_dev
feature_dev
Je potřeba další větev pro druhou novou funkci
Řešení – přejmenovat feature_dev
git branch -m feature_dev chatbot
git branch
main
* chatbot
Velké projekty mohou mít mnoho větví
Dokončené větve je vhodné smazat
Větev chatbot smažeme příznakem -d
git branch -d chatbot
Deleted branch chatbot (was 3edb989).
chatbot nebyla sloučena do main, příkaz git branch -d chatbot vrátí chybuerror: 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).
Obnova smazané větve je obtížná, ale možná
Před smazáním se ujistěte, že větev již nepotřebujete!
| Příkaz | Funkce |
|---|---|
git diff main chatbot |
Porovná stav větví main a chatbot |
git branch |
Zobrazí seznam všech větví |
git branch -m old_name new_name |
Přejmenuje větev old_name na new_name |
git branch -d chatbot |
Smaže větev chatbot, která byla sloučena |
git branch -D chatbot |
Smaže větev chatbot, která nebyla sloučena |
Intermediate Git