Vai al contenuto

Comandi Git

Traduzione: Copia tutti i comandi Traduzione: Generare PDF < > Comprensione Comandi Git e flussi di lavoro per il controllo delle versioni su tutte le piattaforme. ## Comandi di base | | Command | Description | | | --- | --- | | | `git init` | Initialize a new Git repository | | | | `git clone ` | Clone a repository from remote URL | | | | `git status` | Show working directory status | | | | `git add ` | Add file to staging area | | | | `git add .` | Add all files to staging area | | | | `git commit -m "message"` | Commit staged changes with message | | | | `git push` | Push commits to remote repository | | | | `git pull` | Pull changes from remote repository | | ## Braning | | Command | Description | | | --- | --- | | | `git branch` | List all branches | | | | `git branch ` | Create new branch | | | | `git checkout ` | Switch to branch | | | | `git checkout -b ` | Create and switch to new branch | | | | `git merge ` | Merge branch into current branch | | | | `git branch -d ` | Delete branch | | ## Operazioni remote | | Command | Description | | | --- | --- | | | `git remote -v` | Show remote repositories | | | | `git remote add ` | Add remote repository | | | | `git fetch` | Fetch changes from remote | | | | `git push origin ` | Push branch to remote | | | | `git pull origin ` | Pull branch from remote | | ## Comandi avanzati | | Command | Description | | | --- | --- | | | `git log --oneline` | Show commit history in one line | | | | `git diff` | Show changes between commits | | | | `git reset --hard ` | Reset to specific commit | | | | `git stash` | Temporarily save changes | | | | `git stash pop` | Apply stashed changes | | | | `git rebase ` | Rebase current branch | | | | `git cherry-pick ` | Apply specific commit | | | | `git tag ` | Create a tag | | ## Flussi di lavoro comuni ### Caratteristica Branch Workflow Traduzione: ### Flusso di lavoro di Hotfix Traduzione: ## Migliori Pratiche ### Impegnare messaggi - Utilizzare tensione presente ("Aggiungi funzionalità" non "Aggiungi funzionalità") - Mantenere la prima riga sotto 50 caratteri - Utilizzare il corpo per spiegare cosa e perché, non come - Problemi di riferimento e richieste di estrazione quando applicabile ### Strategia di ramificazione - Utilizzare nomi di branch descrittivi - Tenere i rami concentrati su singole caratteristiche - Eliminare rami fusi - Sincronia regolare con ramo principale ### Gestione dei repository - Utilizzare `.gitignore` per escludere i file non necessari - Mantenere gli impegni atomici e concentrati - Scrivere messaggi di commit significativi - Utilizzare i tag per le versioni - Backup regolari per repository remoti