Aggiornamento wiki
parent
a0376c41be
commit
25e76564c9
168
Appunti.md
168
Appunti.md
@ -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)
|
13
Branch.md
Normal file
13
Branch.md
Normal file
@ -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)|
|
||||
|
7
ChiaviSSH.md
Normal file
7
ChiaviSSH.md
Normal file
@ -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.
|
7
Diff.md
Normal file
7
Diff.md
Normal file
@ -0,0 +1,7 @@
|
||||
## Diff controlla le differenza
|
||||
|
||||
```
|
||||
git diff branch1 branch2
|
||||
git diff branch1 branch2 --name-only
|
||||
```
|
||||
|
29
Fare-il-rebase.md
Normal file
29
Fare-il-rebase.md
Normal file
@ -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)
|
28
Home.md
28
Home.md
@ -1 +1,27 @@
|
||||
Benvenuti nella Wiki.
|
||||
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)
|
4
Link-guide.md
Normal file
4
Link-guide.md
Normal file
@ -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)
|
7
Merge.md
Normal file
7
Merge.md
Normal file
@ -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
|
||||
```
|
82
Operazioni-fondamentali.md
Normal file
82
Operazioni-fondamentali.md
Normal file
@ -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
|
||||
```
|
15
Regole-d-oro.md
Normal file
15
Regole-d-oro.md
Normal file
@ -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.
|
3
Relref.md
Normal file
3
Relref.md
Normal file
@ -0,0 +1,3 @@
|
||||
## Uso di relref
|
||||
|
||||
`{{< relref "pages/chi-siamo" >}}`
|
14
Spostare-commit.md
Normal file
14
Spostare-commit.md
Normal file
@ -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
|
||||
```
|
13
_Sidebar.md
13
_Sidebar.md
@ -1,2 +1,13 @@
|
||||
* [Home](Home)
|
||||
* [Appunti](Appunti)
|
||||
|
||||
* [Procedure fond.](Operazioni-fondamentali)
|
||||
|
||||
Comandi:
|
||||
* [Branch](Branch)
|
||||
* [Diff](Diff)
|
||||
* [Merge](Merge)
|
||||
* [Rebase](Fare-il-rebase)
|
||||
* [Relref](Relref)
|
||||
* [Spostare commit](Spostare-commit)
|
||||
|
||||
[Guide](Link-guide)
|
Loading…
x
Reference in New Issue
Block a user