From 25e76564c9558f3a0346a0b8a362069aeb4e6f62 Mon Sep 17 00:00:00 2001 From: omartek Date: Mon, 8 Jul 2024 23:33:45 +0200 Subject: [PATCH] Aggiornamento wiki --- Appunti.md | 168 ------------------------------------- Branch.md | 13 +++ ChiaviSSH.md | 7 ++ Diff.md | 7 ++ Fare-il-rebase.md | 29 +++++++ Home.md | 28 ++++++- Link-guide.md | 4 + Merge.md | 7 ++ Operazioni-fondamentali.md | 82 ++++++++++++++++++ Regole-d-oro.md | 15 ++++ Relref.md | 3 + Spostare-commit.md | 14 ++++ _Sidebar.md | 13 ++- 13 files changed, 220 insertions(+), 170 deletions(-) delete mode 100644 Appunti.md create mode 100644 Branch.md create mode 100644 ChiaviSSH.md create mode 100644 Diff.md create mode 100644 Fare-il-rebase.md create mode 100644 Link-guide.md create mode 100644 Merge.md create mode 100644 Operazioni-fondamentali.md create mode 100644 Regole-d-oro.md create mode 100644 Relref.md create mode 100644 Spostare-commit.md diff --git a/Appunti.md b/Appunti.md deleted file mode 100644 index 3f33ced..0000000 --- a/Appunti.md +++ /dev/null @@ -1,168 +0,0 @@ -## Inserire le chiavi SSH - -Aggiungere le proprie chiavi SSH in gitea a quest'indirizzo: - -https://git.libreschool.org/user/settings/keys - -In questo modo sarà possibile dialogare con i repo on line via SSH. - -## Controllare l'upstream - -Per verificare la situazione dei repository a cui si sta contribuendo eseguire il comando: - -[`git remote -v`](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt--v) - - origin https://git.libreschool.org/user1/bglug.it (fetch) - origin https://git.libreschool.org/user1/bglug.it (push) - - -Se dovessero mancare o si volesse modificare il repository di upstream rimuovere quello presente ed aggiungere quello corretto: - -[`git remote remove upstream`](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emremoveem) ovviamente inutile se non esiste l'upstream) - -[`git remote add upstream ssh://git@git.libreschool.org:1022/BgLUG/bglug.it.git`](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emaddem) - -L'ultimo comando apporterà le seguenti modifiche: - -[`git remote -v`](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt--v) - - official ssh://git@git.libreschool.org:1022/BgLUG/bglug.it.git (fetch) - official ssh://git@git.libreschool.org:1022/BgLUG/bglug.it.git (push) - origin https://git.libreschool.org/user1/bglug.it (fetch) - origin https://git.libreschool.org/user1/bglug.it (push) - -## Aggiornamento del repo locale - -Il comando **fetch** informa il repo in locale delle modifiche avvenute nei remote. -Le modifiche vengono solo lette ma non applicate. -Potrebbe essere eseguito automaticamente, in certi ambienti, ma per eseguirlo manualmente eseguire: - -[`git fetch --all`](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---no-all) - -Per verificare il solo upstream eseguire: - -[`git fetch upstream -v`](https://git-scm.com/docs/git-fetch) - -Per applicarle anche bisogna eseguire il comando **pull**: - -[`git pull`](https://git-scm.com/docs/git-pull) - -Nel caso in cui, per motivi vari, si sospetta che `git pull` possa incasinare il repo, procedere come segue: - -[`git fetch --all`](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---no-all) - -[`git checkout main`](https://git-scm.com/docs/git-checkout) - -[`git reset --hard upstream/main `](https://git-scm.com/search/results?search=reset) - -[`git push --force --set-upstream origin main`](https://git-scm.com/docs/git-push#Documentation/git-push.txt--u) - -## Aggiornamento di origin/main con l'upstream - -``` -git checkout main -git pull upstream main -git push origin main -``` - -## Avanzamento di un branch (da eseguire prima di un a PR) - -È possibile eseguire questo aggiornamento anche via web: dopo aver inviato una PR, nella scheda è presente un pulsante per eseguire il rebase. - -Da terminale: - -``` -git checkout mio-branch -git pull --rebase origin main -git push --force -``` - - -## Merge: unire le modifiche proposte in un ramo con il main - -``` -git checkout main -git merge hotfix -git branch -d hotfix -``` - -## Branch: comandi utili - -Comandi - -|Descrizione|Comando| -| -------- | -------- | -|per visualire i rami presenti | [`git branch -v`](https://git-scm.com/docs/git-branch#Documentation/git-branch.txt--v)| -|per aver più informazionigit |[`branch -vv --all`](https://git-scm.com/docs/git-branch#Documentation/git-branch.txt--v)| -|per creare un branch e renderlo attivo | [`git checkout -b pippo`](https://git-scm.com/docs/git-checkout#Documentation/git-checkout.txt-emgitcheckoutem-b-Bltnew-branchgtltstart-pointgt)| -|per eliminare, dal registro locale, branch non più esistenti in remoto | [`git fetch --prune`](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt--p)| -|per elimare branch locali | [`git branch -d nomebranch`](https://git-scm.com/docs/git-branch#Documentation/git-branch.txt--d)| -|per eliminare branch remoti | [`git push origin :experimental`](https://git-scm.com/docs/git-push#Documentation/git-push.txt-codegitpushoriginexperimentalcode)| - -## Regole d'oro :) - -Dalla pagina del repo originale eseguire il fork cliccando l'icona in alto a destra. - -Tutto potrebbe essere eseguito sia da pagina web che in locale, ma il secondo metodo è preferibile. - -In generale il processo per contribuire al repo si riassume in questi passaggi: - -* Creare un branch a partire dall'ultima commit upstream (se il fork è appena stato fatto non serve fare nulla) altrimenti è necessario un [rebase](#fare-il-rebase) -* Lavorare dentro il branch: nel nostro caso modificare un post e le sue eventuali immagini. -* Fare i commit -* Eseguire fetch e controllare se l'upstream è cambiato e nel caso fare il [rebase](#fare-il-rebase). -* Fare pull-request e una volta accettata, le modifiche saranno inserite in upstream, probabilmente in una commit sola. -* A quel punto il branch non serve più e lo puoi eliminare -* Ogni branch deve contenere un numero limitato di modifiche (diciamo 5 post) e quindi se necessisario crea più di un branch. - -### Fare il rebase - -Mettersi nel ramo main ed eseguire i comandi: - -[`git fetch --all`](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---no-all) - -[`git log`](https://git-scm.com/docs/git-log) - -[`git log upstream/main`](https://git-scm.com/docs/git-log) - -per verificare l'ultimo commit del proprio ramo attuale o di quello passato come argomento. - -Se l'upstream è avanzato (per esempio al commit numero `bc0b63`) eseguire il rebase del proprio ramo con il comando: - -[`git rebase bc0b63`](https://git-scm.com/docs/git-rebase) - -oppure - -[`git rebase upstream/main`](https://git-scm.com/docs/git-rebase) - - -## Uso di relref - -`{{< relref "pages/chi-siamo" >}}` - -## Spostare gli ultimi commit su un ramo e spostare HEAD/main indietro - -Come [indicato qui](https://devdev.it/spostare-dei-commit-su-un-nuovo-ramo-in-git-703/) - -``` -# Creiamo il nuovo ramo -git branch nuovoramo - -# Muoviamo il puntatore su master indietro di 1 commit (o del numero che serve) -git reset --hard HEAD~1 - -# Spostiamoci sul nuovo ramo -git checkout nuovoramo -``` - -## Diff controlla le differenza - -``` -git diff branch1 branch2 -git diff branch1 branch2 --name-only -``` - -## Link a guide -[Sito man-pages](https://git-scm.com/) -[Git visuale](https://marklodato.github.io/visual-git-guide/index-it.html) -[Diff](https://graphite.dev/guides/git-diff-between-branches) \ No newline at end of file diff --git a/Branch.md b/Branch.md new file mode 100644 index 0000000..3da04ec --- /dev/null +++ b/Branch.md @@ -0,0 +1,13 @@ +## Branch: comandi utili + +Comandi + +|Descrizione|Comando| +| -------- | -------- | +|per visualire i rami presenti | [`git branch -v`](https://git-scm.com/docs/git-branch#Documentation/git-branch.txt--v)| +|per aver più informazionigit |[`branch -vv --all`](https://git-scm.com/docs/git-branch#Documentation/git-branch.txt--v)| +|per creare un branch e renderlo attivo | [`git checkout -b pippo`](https://git-scm.com/docs/git-checkout#Documentation/git-checkout.txt-emgitcheckoutem-b-Bltnew-branchgtltstart-pointgt)| +|per eliminare, dal registro locale, branch non più esistenti in remoto | [`git fetch --prune`](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt--p)| +|per elimare branch locali | [`git branch -d nomebranch`](https://git-scm.com/docs/git-branch#Documentation/git-branch.txt--d)| +|per eliminare branch remoti | [`git push origin :experimental`](https://git-scm.com/docs/git-push#Documentation/git-push.txt-codegitpushoriginexperimentalcode)| + diff --git a/ChiaviSSH.md b/ChiaviSSH.md new file mode 100644 index 0000000..561efde --- /dev/null +++ b/ChiaviSSH.md @@ -0,0 +1,7 @@ +## Inserire le chiavi SSH + +Aggiungere le proprie chiavi SSH in gitea a quest'indirizzo: + +https://git.libreschool.org/user/settings/keys + +In questo modo sarà possibile dialogare con i repo on line via SSH. \ No newline at end of file diff --git a/Diff.md b/Diff.md new file mode 100644 index 0000000..7cd6cf6 --- /dev/null +++ b/Diff.md @@ -0,0 +1,7 @@ +## Diff controlla le differenza + +``` +git diff branch1 branch2 +git diff branch1 branch2 --name-only +``` + diff --git a/Fare-il-rebase.md b/Fare-il-rebase.md new file mode 100644 index 0000000..fed7b21 --- /dev/null +++ b/Fare-il-rebase.md @@ -0,0 +1,29 @@ +## Fare il rebase + +In sintesi: + +``` +git checkout mio-branch +git pull --rebase origin main +git push --force +``` + +In dettaglio: + +Mettersi nel ramo main ed eseguire i comandi: + +[`git fetch --all`](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---no-all) + +[`git log`](https://git-scm.com/docs/git-log) + +[`git log upstream/main`](https://git-scm.com/docs/git-log) + +per verificare l'ultimo commit del proprio ramo attuale o di quello passato come argomento. + +Se l'upstream è avanzato (per esempio al commit numero `bc0b63`) eseguire il rebase del proprio ramo con il comando: + +[`git rebase bc0b63`](https://git-scm.com/docs/git-rebase) + +oppure + +[`git rebase upstream/main`](https://git-scm.com/docs/git-rebase) diff --git a/Home.md b/Home.md index 277cad5..fedd0f9 100644 --- a/Home.md +++ b/Home.md @@ -1 +1,27 @@ -Benvenuti nella Wiki. \ No newline at end of file +Benvenuti nella Wiki. + +* [Chiavi SSH](Chiavi-SSH) + +* [Regole d'oro :)](Regole-d-oro) + +* **Procedure fondamentali** + * [Controllare e gestire l'upstream (git REMOTE)](Operazioni-fondamentali#controllare-e-gestire-lupstream-git-remote) + * [Aggiornamento del repo locale (git FETCH)](Appunti#aggiornamento-del-repo-locale-git-fetch) + * [Hard reset del main locale (git RESET)](Operazioni-fondamentali#hard-reset-del-main-locale-git-reset) + * [Aggiornamento di origin/main con l'upstream (git PULL)](Operazioni-fondamentali#aggiornamento-di-originmain-con-lupstream-git-pull) + * [Avanzamento di un branch da eseguire prima di un a PR (git PULL --REBASE)](Operazioni-fondamentali#avanzamento-di-un-branch-da-eseguire-prima-di-un-a-pr-git-pull---rebase) + +* [Merge](Merge) + +* [Branch: comandi utili](Branch) + +* [Fare il rebase](Fare-il-rebase) + +* [Spostare i commit](Spostare-commit) + +* [Differenze tra le versioni con git DIFF](Diff) + +* [Relref - link interni](Relref) + + +* [Link guide online](Link-guide) \ No newline at end of file diff --git a/Link-guide.md b/Link-guide.md new file mode 100644 index 0000000..117416a --- /dev/null +++ b/Link-guide.md @@ -0,0 +1,4 @@ +## Link a guide +[Sito man-pages](https://git-scm.com/) +[Git visuale](https://marklodato.github.io/visual-git-guide/index-it.html) +[Diff](https://graphite.dev/guides/git-diff-between-branches) \ No newline at end of file diff --git a/Merge.md b/Merge.md new file mode 100644 index 0000000..c20fd11 --- /dev/null +++ b/Merge.md @@ -0,0 +1,7 @@ +## Merge: unire le modifiche proposte in un ramo con il main (git MERGE) + +``` +git checkout main +git merge hotfix +git branch -d hotfix +``` \ No newline at end of file diff --git a/Operazioni-fondamentali.md b/Operazioni-fondamentali.md new file mode 100644 index 0000000..08cfec1 --- /dev/null +++ b/Operazioni-fondamentali.md @@ -0,0 +1,82 @@ +## Controllare e gestire l'upstream (git REMOTE) + +Per verificare la situazione dei repository a cui si sta contribuendo eseguire il comando: + +[`git remote -v`](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt--v) + + origin https://git.libreschool.org/user1/bglug.it (fetch) + origin https://git.libreschool.org/user1/bglug.it (push) + + +Se dovessero mancare o si volesse modificare il repository di upstream rimuovere quello presente ed aggiungere quello corretto: + +[`git remote remove upstream`](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emremoveem) ovviamente inutile se non esiste l'upstream) + +[`git remote add upstream ssh://git@git.libreschool.org:1022/BgLUG/bglug.it.git`](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emaddem) + +L'ultimo comando apporterà le seguenti modifiche: + +[`git remote -v`](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt--v) + + official ssh://git@git.libreschool.org:1022/BgLUG/bglug.it.git (fetch) + official ssh://git@git.libreschool.org:1022/BgLUG/bglug.it.git (push) + origin https://git.libreschool.org/user1/bglug.it (fetch) + origin https://git.libreschool.org/user1/bglug.it (push) + +## Aggiornamento del repo locale (git FETCH) + +Il comando **fetch** informa il repo in locale delle modifiche avvenute nei remote. +Le modifiche vengono solo lette ma non applicate. +Potrebbe essere eseguito automaticamente, in certi ambienti, ma per eseguirlo manualmente eseguire: + +[`git fetch --all`](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---no-all) + +Per verificare il solo upstream eseguire: + +[`git fetch upstream -v`](https://git-scm.com/docs/git-fetch) + +Per applicarle anche bisogna eseguire il comando **pull**: + +[`git pull`](https://git-scm.com/docs/git-pull) + +## Hard reset del main locale (git RESET) + +Nel caso in cui, per motivi vari, si sospetta che `git pull` possa incasinare il repo, procedere come segue: + +``` +git fetch --all +git checkout main +git reset --hard upstream/main +git push --force --set-upstream origin main +``` + +Clicca per leggere il manuale per maggiori dettagli: + +[`git fetch --all`](https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---no-all) + +[`git checkout main`](https://git-scm.com/docs/git-checkout) + +[`git reset --hard upstream/main `](https://git-scm.com/search/results?search=reset) + +[`git push --force --set-upstream origin main`](https://git-scm.com/docs/git-push#Documentation/git-push.txt--u) + + +## Aggiornamento di origin/main con l'upstream (git PULL) + +``` +git checkout main +git pull upstream main +git push origin main +``` + +## Avanzamento di un branch, da eseguire prima di una PR (git PULL --REBASE) + +È possibile eseguire questo aggiornamento anche via web: dopo aver inviato una PR, nella scheda è presente un pulsante per eseguire il rebase. + +Da terminale: + +``` +git checkout mio-branch +git pull --rebase origin main +git push --force +``` diff --git a/Regole-d-oro.md b/Regole-d-oro.md new file mode 100644 index 0000000..cecbc6c --- /dev/null +++ b/Regole-d-oro.md @@ -0,0 +1,15 @@ +## Regole d'oro :) + +Dalla pagina del repo originale eseguire il fork cliccando l'icona in alto a destra. + +Tutto potrebbe essere eseguito sia da pagina web che in locale, ma il secondo metodo è preferibile. + +In generale il processo per contribuire al repo si riassume in questi passaggi: + +* Creare un branch a partire dall'ultima commit upstream (se il fork è appena stato fatto non serve fare nulla) altrimenti è necessario un [rebase](#fare-il-rebase) +* Lavorare dentro il branch: nel nostro caso modificare un post e le sue eventuali immagini. +* Fare i commit +* Eseguire fetch e controllare se l'upstream è cambiato e nel caso fare il [rebase](#fare-il-rebase). +* Fare pull-request e una volta accettata, le modifiche saranno inserite in upstream, probabilmente in una commit sola. +* A quel punto il branch non serve più e lo puoi eliminare +* Ogni branch deve contenere un numero limitato di modifiche (diciamo 5 post) e quindi se necessisario crea più di un branch. \ No newline at end of file diff --git a/Relref.md b/Relref.md new file mode 100644 index 0000000..c61de35 --- /dev/null +++ b/Relref.md @@ -0,0 +1,3 @@ +## Uso di relref + +`{{< relref "pages/chi-siamo" >}}` \ No newline at end of file diff --git a/Spostare-commit.md b/Spostare-commit.md new file mode 100644 index 0000000..f999678 --- /dev/null +++ b/Spostare-commit.md @@ -0,0 +1,14 @@ +## Spostare gli ultimi commit su un ramo e spostare HEAD/main indietro + +Come [indicato qui](https://devdev.it/spostare-dei-commit-su-un-nuovo-ramo-in-git-703/) + +``` +# Creiamo il nuovo ramo +git branch nuovoramo + +# Muoviamo il puntatore su master indietro di 1 commit (o del numero che serve) +git reset --hard HEAD~1 + +# Spostiamoci sul nuovo ramo +git checkout nuovoramo +``` \ No newline at end of file diff --git a/_Sidebar.md b/_Sidebar.md index 3ab2a4f..3b5f485 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -1,2 +1,13 @@ * [Home](Home) -* [Appunti](Appunti) \ No newline at end of file + +* [Procedure fond.](Operazioni-fondamentali) + +Comandi: +* [Branch](Branch) +* [Diff](Diff) +* [Merge](Merge) +* [Rebase](Fare-il-rebase) +* [Relref](Relref) +* [Spostare commit](Spostare-commit) + +[Guide](Link-guide) \ No newline at end of file