Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
txt
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Per fare il pull forzando un'altro utente
1) Eseguire git pull oppure git pull origin master
2) Alla richiesta della password digitare invio
3) Verrà visualizzato il link al repository compreso il nome utente
4) modificare il link del punto 3 cambiando il nome utente con il proprio
per avere un risultato simile:
https://carmelomtb@bitbucket.org/treeweb/truecompany.git/info/refs
5) eseguire git pull https://carmelomtb@bitbucket.org/treeweb
/truecompany.git/info/refs
6) per eseguire il pull di un branch (ad esempio master):
git pull https://carmelomtb@bitbucket.org/treeweb/truecompany.git
/info/refs master
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Fare il merge:
Lavoro eseguito su dev da un'altra persona
1) git checkout dev (in locale ci si sposta sul branch dev)
2) git pull (si scaricano le modifiche apportate da un'altra
persona in locale)
3) git checkout master (in locale ci si sposta sul branch master)
4) git merge dev (in locale si fa il merge di dev su master, cioè
si copiano gli aggiornamenti di dev su master)
5) per aggiornare il master in remoto: git push
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
git rev-parse HEAD //Per vedere l'hash dell'attuale commit
git reset --hard HEAD~1 //Per annullare l'ultimo commit !!! Attenzione
elimina eventuali nuovi file e annulla tutte le modifiche ai file
1 di 7 08/04/23, 17:54
Firefox file:///Users/carmelo.catalano/Dati/Guide/git/git.txt
git reset -- (annulla git add)file rimuove i file dallo stage; ovvero
copia i file dell'ultimo commit nello stage. Utilizza questo comando per
annullare un git add file.
Puoi anche utilizzare git reset per rimuovere tutto dallo stage.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Se il repo di default è settato per un altro utente
git remote add c2 https://carmelomtb@bitbucket.org/truelab/incontro-
nespresso.git
git pull c2 master
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Cambiare il commento di un commit
git commit --amend -m "New commit message"
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Configurazione git
git config --list
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Errore git
warning: CRLF will be replaced by LF in eng/inc/contact_form.php.
find ./ -type f -exec dos2unix {} \;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Annullare commit quando ancora non è stato eseguito push
git reset --soft HEAD^
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Annullare add file (git add prova.php)
git reset -- file prova.php
per annullare tutti gli add: git reset HEAD
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Duplicare repository in un nuovo repo
2 di 7 08/04/23, 17:54
Firefox file:///Users/carmelo.catalano/Dati/Guide/git/git.txt
++++++++++++++++++++++++++++++++++++++++++++++++++
Creare tag
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
git tag per i repo mip truelab
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Riportare git alla versione corrente dopo git checkout "id commit" (ad
esempio git checkout b9e5e87)
git checkout master (o il nome del branch in cui ci si trova)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Release
Per vedere tutte le release o tag: git tag -l
Per vedere tag e relative annotazioni: git tag -n
It will list all the tags along with annotations & 9 lines of message for
3 di 7 08/04/23, 17:54
Firefox file:///Users/carmelo.catalano/Dati/Guide/git/git.txt
every tag:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
crea un nuovo branch chiamato "feature_x" e passa al nuovo branch usando
git checkout -b feature_x
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Aggiungere un sottomodulo
4 di 7 08/04/23, 17:54
Firefox file:///Users/carmelo.catalano/Dati/Guide/git/git.txt
/telepassoauth2splunk
2) Committare (Non c'è bisogno di add --all dopo git submodule add)
git commit -m "Modulo aggiuntivo"
3) Pushare
git push
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Clonare un progetto con sottomoduli
2) cd telepass-tsp-2hire-java-server
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Scaricare (pull) l'aggiornamento ad un sottomodulo
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Quando si ha l'errore:
'src/main/java/wiseutility/crypto' esiste già in index
Eseguire
git rm --cached src/main/java/wiseutility/crypto
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rimuovere un sottomodulo (non c'è un comando per rinominare la cartella)
5 di 7 08/04/23, 17:54
Firefox file:///Users/carmelo.catalano/Dati/Guide/git/git.txt
rm -rf .git/modules/src/main/java/wiseutility/kafka
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Vedere l'lenco dei branch:
git branch -a
Eliminare un branch:
git branch -d develop
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
git stash //salvare in un luogo temporaneo le modifiche per poter
cambiare branch
git stash show //mostare i file modificati che sono contenuti nel luogo
temporaneo, esempio:
.../main/java/com/wise/rca/expiration/zurich/inbound/api/rca
/CarInsuranceExpirationReadResourceImpl.java | 6 ++++--
.../src/main/java/com/wise/rca/expiration/zurich/client
/ZurichReadRcaRestClient.java | 3 +--
maven-multi-module/rca-expiration-zurich/src/main/resources
/application.properties | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
git stash list //mostrare l'elenco dei salvataggi nel luogo temporaneo,
esempio:
On branch fix-client
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working
directory)
modified: rca-expiration-zurich-adapter-inbound/src/main/java
/com/wise/rca/expiration/zurich/inbound/api/rca
/CarInsuranceExpirationReadResourceImpl.java
modified: rca-expiration-zurich-client/src/main/java/com/wise
/rca/expiration/zurich/client/ZurichReadRcaRestClient.java
6 di 7 08/04/23, 17:54
Firefox file:///Users/carmelo.catalano/Dati/Guide/git/git.txt
modified: rca-expiration-zurich/src/main/resources
/application.properties
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++
Rinominare branch
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++
Sovrascrivere intero branch
https://gist.github.com/ummahusla/8ccfdae6fbbe50171d77
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++
No stop dopo git branch -a
git config --global pager.branch false
7 di 7 08/04/23, 17:54