Skip to content

Instantly share code, notes, and snippets.

@balanza
Created November 11, 2020 08:11
Show Gist options
  • Save balanza/94c8e383c4454134d4f8876d5229b7d3 to your computer and use it in GitHub Desktop.
Save balanza/94c8e383c4454134d4f8876d5229b7d3 to your computer and use it in GitHub Desktop.
Git for Noobs

Git for noobs

Una serie di comandi base per operare con git senza essere esperti

Fare il punto della situazione

git status

Ti dice in che branch ti trovi, quali file hai modificato, quali sono nell'index.

Annullare tutte le modifiche fatte

git checkout .

Salvare tutte le modifiche (commit)

git add .
git commit -m "un messaggio significativo"

Salvare solo alcuni file (commit)

git add path/to/file1.ext
git add path/to/file2.ext
git commit -m "salvo file1.ext e file2.ext"

Spostarsi su un branch

git checkout mio_branch

Sincronizzare il repo locale con quello remoto

git fetch

Aggornare il branch corrente con le ultime modifiche

git checkout mio_branch
git pull origin mio_branch

Inviare le ultime modifiche

Ricorda che verranno inviati solo i file "salvati" (commit). Le altre modifiche non verranno inviate.

git checkout mio_branch
git pull origin mio_branch # prima aggiorna, è importante!
git push origij mio_branch

Creare un nuovo branch a parire da un altro

git checkout vecchio_branch
git pull origin vecchio_branch # prendi ultime modifiche per partire da una versione aggiornata
git checkout -b nuovo_branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment