risolvere il "detached HEAD" con git

mi è capitato già due volte di avere questo problema, quindi metto qui la soluzione


git branch temp
git checkout temp
git diff master temp
git branch -f master temp
git checkout master
git branch -d temp
git push origin master

Qualche spiegazione:
in sostanza la soluzione è creare un branch temporaneo chiamato temp, mergiarlo con il branch master ed infine committare il tutto sul branch master cancellando il branch temp



Nessun commento :